summaryrefslogtreecommitdiff
path: root/Propellor
diff options
context:
space:
mode:
Diffstat (limited to 'Propellor')
-rw-r--r--Propellor/Property/Docker.hs17
-rw-r--r--Propellor/Property/SiteSpecific/JoeySites.hs16
-rw-r--r--Propellor/SimpleSh.hs35
3 files changed, 44 insertions, 24 deletions
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 ]
diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs
index bdc60a5b..28b3dffd 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
@@ -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/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