From 4a7b19ea49923de05aca639816d27dc184cdb25a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 7 Mar 2016 17:05:25 -0400 Subject: 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. --- src/Propellor/Bootstrap.hs | 4 ++-- src/Propellor/Property/Cron.hs | 6 ++++-- src/Propellor/Spin.hs | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/Propellor') 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" ] -- cgit v1.2.3