propellor spin
This commit is contained in:
parent
0720bc499f
commit
6d5919199d
|
@ -54,6 +54,7 @@ spin host = do
|
||||||
url <- getUrl
|
url <- getUrl
|
||||||
privdata <- gpgDecrypt (privDataFile host)
|
privdata <- gpgDecrypt (privDataFile host)
|
||||||
void $ boolSystem "git" [Param "commit", Param "-a", Param "-m", Param "propellor spin"]
|
void $ boolSystem "git" [Param "commit", Param "-a", Param "-m", Param "propellor spin"]
|
||||||
|
void $ boolSystem "git" [Param "push"]
|
||||||
withHandle StdinHandle createProcessSuccess
|
withHandle StdinHandle createProcessSuccess
|
||||||
(proc "ssh" ["root@"++host, bootstrap url]) $ \h -> do
|
(proc "ssh" ["root@"++host, bootstrap url]) $ \h -> do
|
||||||
hPutStr h $ unlines $ map (privDataMarker ++) $ lines privdata
|
hPutStr h $ unlines $ map (privDataMarker ++) $ lines privdata
|
||||||
|
@ -79,6 +80,7 @@ boot props = do
|
||||||
. filter (privDataMarker `isPrefixOf`)
|
. filter (privDataMarker `isPrefixOf`)
|
||||||
. lines
|
. lines
|
||||||
<$> getContents
|
<$> getContents
|
||||||
|
makePrivDataDir
|
||||||
writeFileProtected privDataLocal (unlines privdata)
|
writeFileProtected privDataLocal (unlines privdata)
|
||||||
ensureProperties props
|
ensureProperties props
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,16 @@ getPrivData field = do
|
||||||
|
|
||||||
setPrivData :: HostName -> PrivDataField -> String -> IO ()
|
setPrivData :: HostName -> PrivDataField -> String -> IO ()
|
||||||
setPrivData host field value = do
|
setPrivData host field value = do
|
||||||
|
makePrivDataDir
|
||||||
let f = privDataFile host
|
let f = privDataFile host
|
||||||
m <- fromMaybe M.empty . readish <$> gpgDecrypt f
|
m <- fromMaybe M.empty . readish <$> gpgDecrypt f
|
||||||
let m' = M.insert field value m
|
let m' = M.insert field value m
|
||||||
gpgEncrypt f (show m')
|
gpgEncrypt f (show m')
|
||||||
void $ boolSystem "git" [Param "add", File f]
|
void $ boolSystem "git" [Param "add", File f]
|
||||||
|
|
||||||
|
makePrivDataDir :: IO ()
|
||||||
|
makePrivDataDir = createDirectoryIfMissing False privDataDir
|
||||||
|
|
||||||
privDataDir :: FilePath
|
privDataDir :: FilePath
|
||||||
privDataDir = "privdata"
|
privDataDir = "privdata"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue