summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess2015-10-16 14:20:13 -0400
committerJoey Hess2015-10-16 14:23:01 -0400
commite66b62f40bcb29ca62c905dabe87cc6e91a6bccd (patch)
treeab317c5bccecfb347c4dc4d9f122334532397fba /src/Propellor/Types/CmdLine.hs
parente5b5a190b7de979cd889c92ecff530417534864e (diff)
Added Propellor.Property.Spin, which can be used to make a host be a controller of other hosts.
The hard part of this is avoiding loops of controllers. To make that work, a ControllerChain is passed to the host that's spun, and is added to the Info of the host being spun, where the controller property can check it to detect an avoid a loop. That needed an expansion of the CmdLine data type. I made the new ControlledRun only be used when there is a ControllerChain provided. This avoids breaking backwards compatability with old propellor deployments, as --spin still uses SimpleRun. Note: Making an old propellor deployment be controlled by a controller won't work until it's been updated to this commit, so it knows about the ControlledRun parameter. (Untested)
Diffstat (limited to 'src/Propellor/Types/CmdLine.hs')
-rw-r--r--src/Propellor/Types/CmdLine.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Propellor/Types/CmdLine.hs b/src/Propellor/Types/CmdLine.hs
index 50908514..380ac5a8 100644
--- a/src/Propellor/Types/CmdLine.hs
+++ b/src/Propellor/Types/CmdLine.hs
@@ -1,14 +1,20 @@
+{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
+
module Propellor.Types.CmdLine where
import Propellor.Types.OS
import Propellor.Types.PrivData
import System.Posix.Types
+import Data.Typeable
+import Data.Monoid
+-- | All the command line actions that propellor can perform.
data CmdLine
= Run HostName
| Spin [HostName] (Maybe HostName)
| SimpleRun HostName
+ | ControlledRun HostName ControllerChain
| Set PrivDataField Context
| Unset PrivDataField Context
| Dump PrivDataField Context
@@ -28,3 +34,6 @@ data CmdLine
| Check
deriving (Read, Show, Eq)
+-- | List of hosts that acted as controllers to cause a host to be spinned.
+newtype ControllerChain = ControllerChain [HostName]
+ deriving (Read, Show, Eq, Typeable, Monoid)