From 9c0e9e2f192541db06d6559722c64ee740975236 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 May 2014 13:30:23 -0300 Subject: propellor spin --- Propellor/Property/Docker.hs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/Docker.hs b/Propellor/Property/Docker.hs index e5b8d64a..6757c7cc 100644 --- a/Propellor/Property/Docker.hs +++ b/Propellor/Property/Docker.hs @@ -346,11 +346,18 @@ provisionContainer cid = containerDesc cid $ property "provision" $ liftIO $ do hPutStrLn stderr s hFlush stderr go Nothing rest - Done -> ret lastline - go lastline [] = ret lastline - - ret lastline = return $ fromMaybe FailedChange $ - readish =<< lastline + Done -> do + debug ["reached Done"] + ret lastline + go lastline [] = do + debug ["reached end of output"] + ret lastline + + ret lastline = do + let v = fromMaybe FailedChange $ + readish =<< lastline + debug ["provisionContainer returning", show v] + return v stopContainer :: ContainerId -> IO Bool stopContainer cid = boolSystem dockercmd [Param "stop", Param $ fromContainerId cid ] -- cgit v1.3-2-g0d8e From 1123b9b4693193af9152e7ce6828d31d86decbc6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 9 May 2014 09:42:45 -0300 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index bdc60a5b..1d555537 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -105,7 +105,8 @@ kgbServer = withOS desc $ \o -> case o of mumbleServer :: [Host] -> Property mumbleServer hosts = combineProperties "mumble.debian.net" - [ Obnam.latestVersion + [ Apt.serviceInstalledRunning "mumble-server" + , Obnam.latestVersion , Obnam.backup "/var/lib/mumble-server" "55 5 * * *" [ "--repository=sftp://joey@turtle.kitenet.net/~/lib/backup/mumble.debian.net.obnam" , "--client-name=mumble" @@ -113,7 +114,6 @@ mumbleServer hosts = combineProperties "mumble.debian.net" `requires` Ssh.keyImported SshRsa "root" `requires` Ssh.knownHost hosts "turtle.kitenet.net" "root" , trivial $ cmdProperty "chown" ["-R", "mumble-server:mumble-server", "/var/lib/mumble-server"] - , Apt.serviceInstalledRunning "mumble-server" ] obnamLowMem :: Property -- cgit v1.3-2-g0d8e From 26254bf8c79a83bc5e76deea81a3cabfaec6c8b2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 9 May 2014 10:31:30 -0300 Subject: propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 12 ++++++++++++ config-joey.hs | 3 +-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 1d555537..28b3dffd 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -300,3 +300,15 @@ twitRss = combineProperties "twitter rss" crontime = "15 * * * *" feed url desc = Cron.job desc crontime "joey" dir $ "./twitRss " ++ shellEscape url ++ " > " ++ shellEscape ("../" ++ desc ++ ".rss") + +ircBouncer :: Property +ircBouncer = propertyList "IRC bouncer" + [ Apt.installed ["znc"] + , User.accountFor "znc" + , File.hasPrivContent conf + , File.ownerGroup conf "znc" "znc" + , Cron.job "znconboot" "@reboot" "znc" "~" "znc" + , Cron.job "zncrunning" "@hourly" "znc" "~" "znc || true" + ] + where + conf = "/home/znc/.znc/configs/znc.conf" diff --git a/config-joey.hs b/config-joey.hs index 38e9b096..c7c3f3be 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -74,8 +74,7 @@ hosts = -- (o) ` & myDnsSecondary & alias "znc.kitenet.net" - & Apt.installed ["znc"] - & User.accountFor "znc" + & JoeySites.ircBouncer -- Nothing is using https on clam, so listen on that port -- for ssh, for traveling on bad networks. -- cgit v1.3-2-g0d8e From ee06f4ce46074989b0f65d788805bcb9198ffc82 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 9 May 2014 12:02:05 -0300 Subject: propellor spin --- Propellor/SimpleSh.hs | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'Propellor') diff --git a/Propellor/SimpleSh.hs b/Propellor/SimpleSh.hs index 73ff41ae..d99268d1 100644 --- a/Propellor/SimpleSh.hs +++ b/Propellor/SimpleSh.hs @@ -35,14 +35,7 @@ simpleSh namedpipe = do maybe noop (run h) . readish =<< hGetLine h where run h (Cmd cmd params) = do - let p = (proc cmd params) - { std_in = Inherit - , std_out = CreatePipe - , std_err = CreatePipe - } - (Nothing, Just outh, Just errh, pid) <- createProcess p chan <- newChan - let runwriter = do v <- readChan chan hPutStrLn h (show v) @@ -52,20 +45,28 @@ simpleSh namedpipe = do _ -> runwriter writer <- async runwriter - let mkreader t from = maybe noop (const $ mkreader t from) - =<< catchMaybeIO (writeChan chan . t =<< hGetLine from) - void $ concurrently - (mkreader StdoutLine outh) - (mkreader StderrLine errh) + flip catchIO (\_e -> writeChan chan Done) $ do + let p = (proc cmd params) + { std_in = Inherit + , std_out = CreatePipe + , std_err = CreatePipe + } + (Nothing, Just outh, Just errh, pid) <- createProcess p + + let mkreader t from = maybe noop (const $ mkreader t from) + =<< catchMaybeIO (writeChan chan . t =<< hGetLine from) + void $ concurrently + (mkreader StdoutLine outh) + (mkreader StderrLine errh) - void $ tryIO $ waitForProcess pid + void $ tryIO $ waitForProcess pid - writeChan chan Done + writeChan chan Done - wait writer + hClose outh + hClose errh - hClose outh - hClose errh + wait writer hClose h simpleShClient :: FilePath -> String -> [String] -> ([Resp] -> IO a) -> IO a -- cgit v1.3-2-g0d8e