diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-07 17:05:25 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-07 17:05:25 -0400 |
| commit | 4a7b19ea49923de05aca639816d27dc184cdb25a (patch) | |
| tree | 6da836d12928daa43689e8e07f9e500b15c7fae0 /src/Propellor | |
| parent | a654b64ac5d466039494673c5e829c94a3902ce2 (diff) | |
make Cron.runPropellor pass System to bootstrapPropellorCommand
Rather than having the property fail when the Host has no OS defined,
I made bootstrapPropellorCommand not install deps in this situation.
The cron job will (probably) still work, unless a system upgrade causes
deps to be removed.
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/Bootstrap.hs | 4 | ||||
| -rw-r--r-- | src/Propellor/Property/Cron.hs | 6 | ||||
| -rw-r--r-- | src/Propellor/Spin.hs | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/Propellor/Bootstrap.hs b/src/Propellor/Bootstrap.hs index 58480832..633a2ff4 100644 --- a/src/Propellor/Bootstrap.hs +++ b/src/Propellor/Bootstrap.hs @@ -15,8 +15,8 @@ type ShellCommand = String -- Shell command line to ensure propellor is bootstrapped and ready to run. -- Should be run inside the propellor config dir, and will install -- all necessary build dependencies and build propellor. -bootstrapPropellorCommand :: System -> ShellCommand -bootstrapPropellorCommand sys = checkDepsCommand sys ++ +bootstrapPropellorCommand :: Maybe System -> ShellCommand +bootstrapPropellorCommand msys = maybe "true" checkDepsCommand msys ++ "&& if ! test -x ./propellor; then " ++ buildCommand ++ "; fi;" ++ checkBinaryCommand diff --git a/src/Propellor/Property/Cron.hs b/src/Propellor/Property/Cron.hs index a6ab3eca..365e2903 100644 --- a/src/Propellor/Property/Cron.hs +++ b/src/Propellor/Property/Cron.hs @@ -81,5 +81,7 @@ niceJob desc times user cddir command = job desc times user cddir -- | Installs a cron job to run propellor. runPropellor :: Times -> Property NoInfo -runPropellor times = niceJob "propellor" times (User "root") localdir "true" --- (bootstrapPropellorCommand ++ "; ./propellor") +runPropellor times = withOS "propellor cron job" $ \o -> + ensureProperty $ + niceJob "propellor" times (User "root") localdir + (bootstrapPropellorCommand o ++ "; ./propellor") diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs index a2afe29f..2c57f57d 100644 --- a/src/Propellor/Spin.hs +++ b/src/Propellor/Spin.hs @@ -84,7 +84,7 @@ spin' mprivdata relay target hst = do -- Install, or update the remote propellor. updateServer target relay hst (proc "ssh" $ cacheparams ++ [sshtarget, shellWrap (probecmd o)]) - (proc "ssh" $ cacheparams ++ [sshtarget, shellWrap (updatecmd o)]) + (proc "ssh" $ cacheparams ++ [sshtarget, shellWrap (updatecmd (Just o))]) =<< getprivdata -- And now we can run it. @@ -102,7 +102,7 @@ spin' mprivdata relay target hst = do [ installGitCommand sys , "echo " ++ toMarked statusMarker (show NeedGitClone) ] ++ ") || echo " ++ toMarked statusMarker (show NeedPrecompiled) - , "else " ++ (updatecmd sys) + , "else " ++ (updatecmd (Just sys)) , "fi" ] |
