diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-10-20 15:43:44 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-10-20 15:43:44 -0400 |
| commit | f66fdc8effe90d801d26604d36c01838488545b3 (patch) | |
| tree | 6590460fd63fcd56503e53d5f967e1a8824071cd /src/Propellor/Property | |
| parent | 9c48a095a4ce1ddd309644338b8b11049f19d719 (diff) | |
| parent | eeabdf5e30d5b5f88788151e1f0231d8ea562562 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property')
| -rw-r--r-- | src/Propellor/Property/Spin.hs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Propellor/Property/Spin.hs b/src/Propellor/Property/Spin.hs index 5f857ef4..144f8197 100644 --- a/src/Propellor/Property/Spin.hs +++ b/src/Propellor/Property/Spin.hs @@ -8,7 +8,7 @@ module Propellor.Property.Spin ( ) where import Propellor.Base -import Propellor.Spin (spin) +import Propellor.Spin (spin, SpinMode(..)) import Propellor.Types.Info import qualified Propellor.Property.Ssh as Ssh @@ -19,7 +19,7 @@ class Spinnable t where toSpin :: t -> Property HasInfo instance Spinnable Host where - toSpin h = infoProperty desc go (mkControllingInfo h) [] + toSpin h = infoProperty desc go (mkControllingInfo h <> privinfo) [] `requires` Ssh.knownHost [h] (hostName h) (User "root") where desc = cdesc (hostName h) @@ -33,11 +33,18 @@ instance Spinnable Host where , hostName h ] else do - liftIO $ spin (hostName h) Nothing h - -- Don't know if the spin made a change to the - -- remote host or not, but in any case, the + liftIO $ spin ControllingSpin (hostName h) h + -- Don't know if the spin made a + -- change to the remote host or not, + -- but in any case, the -- local host was not changed. noChange + -- Make the controlling host have all the remote host's + -- PrivData, so it can send it on to the remote host + -- when spinning it. + privinfo = addInfo mempty $ + forceHostContext (hostName h) $ + getInfo (hostInfo h) -- | Each Host in the list is spinned in turn. Does not stop on spin -- failure; does propagate overall success/failure. @@ -55,7 +62,7 @@ instance Spinnable [Host] where -- The controller needs to be able to ssh to the hosts it controls, -- and run propellor, as root. The controller is automatically configured -- with `Propellor.Property.Ssh.knownHost` to know the host keys of the --- hosts that it will ssh to. It's up to you to use `controllerKey` +-- hosts that it will ssh to. It's up to you to use `controllerKeys` -- and `controlledBy` to set up the ssh keys that will let the controller -- log into the hosts it controls. -- @@ -101,6 +108,8 @@ instance Spinnable [Host] where -- -- Chains of controllers are supported; host A can control host B which -- controls host C. Loops of controllers are automatically prevented. +-- +-- Note that a controller can see all PrivInfo of the hosts it controls. controllerFor :: Spinnable h => h -> Property HasInfo controllerFor h = toSpin h `requires` Ssh.installed |
