propellor spin

This commit is contained in:
Joey Hess 2014-03-30 19:19:29 -04:00
parent 0720bc499f
commit 6d5919199d
2 changed files with 6 additions and 0 deletions

View File

@ -54,6 +54,7 @@ spin host = do
url <- getUrl
privdata <- gpgDecrypt (privDataFile host)
void $ boolSystem "git" [Param "commit", Param "-a", Param "-m", Param "propellor spin"]
void $ boolSystem "git" [Param "push"]
withHandle StdinHandle createProcessSuccess
(proc "ssh" ["root@"++host, bootstrap url]) $ \h -> do
hPutStr h $ unlines $ map (privDataMarker ++) $ lines privdata
@ -79,6 +80,7 @@ boot props = do
. filter (privDataMarker `isPrefixOf`)
. lines
<$> getContents
makePrivDataDir
writeFileProtected privDataLocal (unlines privdata)
ensureProperties props

View File

@ -39,12 +39,16 @@ getPrivData field = do
setPrivData :: HostName -> PrivDataField -> String -> IO ()
setPrivData host field value = do
makePrivDataDir
let f = privDataFile host
m <- fromMaybe M.empty . readish <$> gpgDecrypt f
let m' = M.insert field value m
gpgEncrypt f (show m')
void $ boolSystem "git" [Param "add", File f]
makePrivDataDir :: IO ()
makePrivDataDir = createDirectoryIfMissing False privDataDir
privDataDir :: FilePath
privDataDir = "privdata"