diff options
| author | Joey Hess <joey@kitenet.net> | 2014-11-23 15:17:57 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-11-23 15:17:57 -0400 |
| commit | 0ea0f7f4dee7f0e0835a82814fa89af6ce1756a1 (patch) | |
| tree | 6eb9bbd4dfb6efc287a7174bdf9e0bbf0319221a /src/Propellor/Spin.hs | |
| parent | 3c952a0de9d228eafe6e208007be7d2e018d68b8 (diff) | |
--spin can be passed multiple hosts, and it will provision each host in turn.
Note that if it fails to spin a host, it will stop. I think this is better
than continuing to the next, because there might be a reason to spin hosts
in some specific order (ie, update dns first and then use it).
Diffstat (limited to 'src/Propellor/Spin.hs')
| -rw-r--r-- | src/Propellor/Spin.hs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs index 06bac330..8606013a 100644 --- a/src/Propellor/Spin.hs +++ b/src/Propellor/Spin.hs @@ -1,4 +1,5 @@ module Propellor.Spin ( + commitSpin, spin, update, gitPushHelper @@ -23,18 +24,19 @@ import qualified Propellor.Shim as Shim import Utility.FileMode import Utility.SafeCommand +commitSpin :: IO () +commitSpin = do + void $ actionMessage "Git commit" $ + gitCommit [Param "--allow-empty", Param "-a", Param "-m", Param "propellor spin"] + -- Push to central origin repo first, if possible. + -- The remote propellor will pull from there, which avoids + -- us needing to send stuff directly to the remote host. + whenM hasOrigin $ + void $ actionMessage "Push to central git repository" $ + boolSystem "git" [Param "push"] + spin :: HostName -> Maybe HostName -> Host -> IO () spin target relay hst = do - unless relaying $ do - void $ actionMessage "Git commit" $ - gitCommit [Param "--allow-empty", Param "-a", Param "-m", Param "propellor spin"] - -- Push to central origin repo first, if possible. - -- The remote propellor will pull from there, which avoids - -- us needing to send stuff directly to the remote host. - whenM hasOrigin $ - void $ actionMessage "Push to central git repository" $ - boolSystem "git" [Param "push"] - cacheparams <- if viarelay then pure ["-A"] else toCommand <$> sshCachingParams hn @@ -78,7 +80,7 @@ spin target relay hst = do runcmd = "cd " ++ localdir ++ " && ./propellor " ++ cmd cmd = if viarelay - then "--serialized " ++ shellEscape (show (Spin target (Just target))) + then "--serialized " ++ shellEscape (show (Spin [target] (Just target))) else "--continue " ++ shellEscape (show (SimpleRun target)) -- Update the privdata, repo url, and git repo over the ssh |
