Wait for lsyncd rsync to finish successfully
Add logic to the lsyncd rsync configuration to wait for a successful rsync event before issuing the postcmd. The existing code issued the postcmd immediately after spawning the rsync, which caused a race condition. Change-Id: I412b5ed7762d825c345a2e2afa6f6088d69ba6b4 Closes-bug: #1649760
This commit is contained in:
parent
bd2a838326
commit
55eb0f8830
@ -223,7 +223,6 @@ rsync.action = function( inlet )
|
||||
config.source,
|
||||
config.target
|
||||
)
|
||||
prepost(config, 'postcmd')
|
||||
end
|
||||
|
||||
|
||||
@ -298,7 +297,6 @@ rsync.init = function(event)
|
||||
target
|
||||
)
|
||||
end
|
||||
prepost(config, 'postcmd')
|
||||
end
|
||||
|
||||
|
||||
@ -542,6 +540,18 @@ rsync.prepare =
|
||||
|
||||
end
|
||||
|
||||
---
|
||||
--- Collect events and run postcmd after successful rsync
|
||||
---
|
||||
rsync.collect = function(agent, exitcode)
|
||||
log('Normal', 'Collecting event, exitcode: ', exitcode)
|
||||
local rc = default.collect(agent, exitcode)
|
||||
if rc ~= 'again'
|
||||
then
|
||||
prepost(agent.config, 'postcmd')
|
||||
end
|
||||
return rc
|
||||
end
|
||||
|
||||
--
|
||||
-- By default do deletes.
|
||||
|
Loading…
x
Reference in New Issue
Block a user