Merge pull request #307 from fabled/master

Fix lpostcmd example
This commit is contained in:
Axel Kittenberger 2015-10-14 14:38:38 +02:00
commit a18ba20365
1 changed files with 11 additions and 3 deletions

View File

@ -11,6 +11,14 @@ local rsyncpostcmd = {
-- based on default rsync. -- based on default rsync.
default.rsync, default.rsync,
checkgauge = {
default.rsync.checkgauge,
host = true,
targetdir = true,
target = true,
postcmd = true,
},
-- for this config it is important to keep maxProcesses at 1, so -- for this config it is important to keep maxProcesses at 1, so
-- the postcmds will only be spawned after the rsync completed -- the postcmds will only be spawned after the rsync completed
maxProcesses = 1, maxProcesses = 1,
@ -25,7 +33,7 @@ local rsyncpostcmd = {
-- uses rawget to test if "isPostcmd" has been set without -- uses rawget to test if "isPostcmd" has been set without
-- triggering an error if not. -- triggering an error if not.
local isPostcmd = rawget(event, "isPostcmd") local isPostcmd = rawget(event, "isPostcmd")
if event.isPostcmd then if isPostcmd then
spawn(event, "/usr/bin/ssh", spawn(event, "/usr/bin/ssh",
config.host, config.postcmd) config.host, config.postcmd)
return return
@ -62,7 +70,7 @@ local rsyncpostcmd = {
-- called before anything else -- called before anything else
-- builds the target from host and targetdir -- builds the target from host and targetdir
prepare = function(config) prepare = function(config, level, skipTarget)
if not config.host then if not config.host then
error("rsyncpostcmd neets 'host' configured", 4) error("rsyncpostcmd neets 'host' configured", 4)
end end
@ -72,7 +80,7 @@ local rsyncpostcmd = {
if not config.target then if not config.target then
config.target = config.host .. ":" .. config.targetdir config.target = config.host .. ":" .. config.targetdir
end end
return default.rsync.prepare(config) return default.rsync.prepare(config, level, skipTarget)
end end
} }