From e6ce744078aed2840ea51cc49ac6149ac6f4418d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 6 Jul 2014 17:15:27 -0400 Subject: move privdata Property to toplevel so its Info propigates Ugh, that's a nasty gotcha but I cannot see a way to fix it generally right now. --- src/Propellor/CmdLine.hs | 6 +++--- src/Propellor/PrivData.hs | 4 ++++ src/Propellor/Property/SiteSpecific/JoeySites.hs | 24 +++++++++++++----------- 3 files changed, 20 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs index c4a3afec..5e20427e 100644 --- a/src/Propellor/CmdLine.hs +++ b/src/Propellor/CmdLine.hs @@ -186,7 +186,7 @@ spin hn = do where go cacheparams url privdata = withBothHandles createProcessSuccess (proc "ssh" $ cacheparams ++ [user, bootstrapcmd]) $ \(toh, fromh) -> do let finish = do - senddata toh privDataLocal privDataMarker privdata + senddata toh "privdata" privDataMarker privdata hClose toh -- Display remaining output. @@ -228,8 +228,8 @@ spin hn = do Just status -> return status showremote s = putStrLn s - senddata toh f marker s = void $ - actionMessage ("Sending " ++ f ++ " (" ++ show (length s) ++ " bytes) to " ++ hn) $ do + senddata toh desc marker s = void $ + actionMessage ("Sending " ++ desc ++ " (" ++ show (length s) ++ " bytes) to " ++ hn) $ do sendMarked toh marker s return True diff --git a/src/Propellor/PrivData.hs b/src/Propellor/PrivData.hs index 27d49926..0194c969 100644 --- a/src/Propellor/PrivData.hs +++ b/src/Propellor/PrivData.hs @@ -42,6 +42,10 @@ import Utility.Table -- Note that if the value is not available, the action is not run -- and instead it prints a message to help the user make the necessary -- private data available. +-- +-- The resulting Property includes Info about the PrivDataField +-- being used, which is necessary to ensure that the privdata is sent to +-- the remote host by propellor. withPrivData :: PrivDataField -> Context diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index bffc8a30..803b726e 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -93,17 +93,19 @@ oldUseNetInstalled pkg = check (not <$> Apt.isInstalled pkg) $ kgbServer :: Property -kgbServer = withOS desc $ \o -> case o of - (Just (System (Debian Unstable) _)) -> - ensureProperty $ propertyList desc - [ Apt.serviceInstalledRunning "kgb-bot" - , File.hasPrivContent "/etc/kgb-bot/kgb.conf" anyContext - `onChange` Service.restarted "kgb-bot" - , "/etc/default/kgb-bot" `File.containsLine` "BOT_ENABLED=1" - `describe` "kgb bot enabled" - `onChange` Service.running "kgb-bot" - ] - _ -> error "kgb server needs Debian unstable (for kgb-bot 1.31+)" +kgbServer = propertyList desc + [ withOS desc $ \o -> case o of + (Just (System (Debian Unstable) _)) -> + ensureProperty $ propertyList desc + [ Apt.serviceInstalledRunning "kgb-bot" + , "/etc/default/kgb-bot" `File.containsLine` "BOT_ENABLED=1" + `describe` "kgb bot enabled" + `onChange` Service.running "kgb-bot" + ] + _ -> error "kgb server needs Debian unstable (for kgb-bot 1.31+)" + , File.hasPrivContent "/etc/kgb-bot/kgb.conf" anyContext + `onChange` Service.restarted "kgb-bot" + ] where desc = "kgb.kitenet.net setup" -- cgit v1.2.3