From 745f42c1499749345c32736342959584587c9b57 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Oct 2015 23:33:19 -0400 Subject: simplify privdata propigation to spin from controller --- src/Propellor/Property/ControlHeir.hs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/Propellor/Property/ControlHeir.hs') diff --git a/src/Propellor/Property/ControlHeir.hs b/src/Propellor/Property/ControlHeir.hs index c51c9b52..9fd2ce43 100644 --- a/src/Propellor/Property/ControlHeir.hs +++ b/src/Propellor/Property/ControlHeir.hs @@ -8,7 +8,8 @@ module Propellor.Property.ControlHeir ( ) where import Propellor.Base -import Propellor.Spin (spin, SpinMode(..)) +import Propellor.Spin (spin') +import Propellor.PrivData.Paths import Propellor.Types.Info import qualified Propellor.Property.Ssh as Ssh @@ -170,13 +171,6 @@ controllerFor h = infoProperty desc go (mkControllingInfo h <> privinfo) [] where desc = cdesc (hostName h) - go = do - 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. @@ -184,6 +178,15 @@ controllerFor h = infoProperty desc go (mkControllingInfo h <> privinfo) [] forceHostContext (hostName h) $ getInfo (hostInfo h) + go = do + pm <- liftIO $ filterPrivData h . readPrivData + <$> readFileStrictAnyEncoding privDataLocal + liftIO $ spin' (Just pm) Nothing (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 + -- | Use this property to let the specified controller Host ssh in -- and run propellor. controlledBy :: Host -> Property NoInfo -- cgit v1.3-2-g0d8e