summaryrefslogtreecommitdiff
path: root/Propellor
diff options
context:
space:
mode:
authorJoey Hess2014-03-31 14:59:06 -0400
committerJoey Hess2014-03-31 14:59:06 -0400
commit35d79711fcbb2f2f436e50a734ae7d64dda78ea8 (patch)
tree82b1398688a66f562ba5db6408fadb0943fd2827 /Propellor
parente4c58842527cbb74997a21b8d87460ba6cd78c46 (diff)
propellor spin
Diffstat (limited to 'Propellor')
-rw-r--r--Propellor/CmdLine.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/Propellor/CmdLine.hs b/Propellor/CmdLine.hs
index 3939309d..c36c1377 100644
--- a/Propellor/CmdLine.hs
+++ b/Propellor/CmdLine.hs
@@ -52,11 +52,12 @@ usage = do
defaultMain :: (HostName -> Maybe [Property]) -> IO ()
defaultMain getprops = go =<< processCmdLine
where
- go (Run host) = maybe (unknownhost host) ensureProperties (getprops host)
- go (Spin host) = spin host
- go (Boot host) = maybe (unknownhost host) boot (getprops host)
+ go (Run host) = withprops host ensureProperties
+ go (Spin host) = withprops host (const $ spin host)
+ go (Boot host) = withprops host boot
go (Set host field) = setPrivData host field
go (AddKey keyid) = addKey keyid
+ withprops host a = maybe (unknownhost host) a (getprops host)
unknownhost :: HostName -> IO a
unknownhost h = error $ unwords
@@ -74,11 +75,10 @@ spin host = do
status <- getstatus fromh `catchIO` error "protocol error"
case status of
NeedKeyRing -> do
- s <- w82s . BL.unpack . B64.encode
- <$> BL.readFile keyring
- putStr $ "Sending " ++ keyring ++ " (" ++ show (BL.length s) ++ " bytes) to " ++ host ++ "..."
+ d <- BL.readFile keyring
+ putStr $ "Sending " ++ keyring ++ " (" ++ show (BL.length d) ++ " bytes) to " ++ host ++ "..."
hFlush stdout
- hPutStrLn toh $ toMarked keyringMarker s
+ hPutStrLn toh $ toMarked keyringMarker $ w82s $ BL.unpack $ B64.encode d
hFlush toh
putStrLn "done"
HaveKeyRing -> noop