propellor spin
This commit is contained in:
parent
0720bc499f
commit
6d5919199d
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue