summaryrefslogtreecommitdiff
path: root/Propellor/PrivData.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-01 18:42:32 -0400
committerJoey Hess2014-04-01 18:42:32 -0400
commit4e7928efb6a311f64f3bf3239b5f8e8ecfa6317c (patch)
tree6c05b9a764ae8cc629dcda5bbe4c710fbf423712 /Propellor/PrivData.hs
parentccd5557abe68c53c653586005ad4a69f82eb5b29 (diff)
propellor spin
Diffstat (limited to 'Propellor/PrivData.hs')
-rw-r--r--Propellor/PrivData.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Propellor/PrivData.hs b/Propellor/PrivData.hs
index d97a7725..e768ae9e 100644
--- a/Propellor/PrivData.hs
+++ b/Propellor/PrivData.hs
@@ -33,7 +33,7 @@ getPrivData field = do
setPrivData :: HostName -> PrivDataField -> IO ()
setPrivData host field = do
putStrLn "Enter private data on stdin; ctrl-D when done:"
- value <- hGetContentsStrict stdin
+ value <- chomp <$> hGetContentsStrict stdin
makePrivDataDir
let f = privDataFile host
m <- fromMaybe M.empty . readish <$> gpgDecrypt f
@@ -41,6 +41,10 @@ setPrivData host field = do
gpgEncrypt f (show m')
putStrLn "Private data set."
void $ boolSystem "git" [Param "add", File f]
+ where
+ chomp s
+ | end s == "\n" = chomp (beginning s)
+ | otherwise = s
makePrivDataDir :: IO ()
makePrivDataDir = createDirectoryIfMissing False privDataDir