diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-18 03:59:06 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-18 03:59:06 -0400 |
| commit | 4e4fb9ab7ca13f5148c6d4b08f53f518429530a8 (patch) | |
| tree | e44754f3e3a49d811d3387495ca24a475bd00162 /Propellor/Attr.hs | |
| parent | 66921ff667705e427c1000b7ae071f03fc0eb567 (diff) | |
get rid of AttrProperty
Now both Property and RevertableProperty can influence Attr on their own.
Diffstat (limited to 'Propellor/Attr.hs')
| -rw-r--r-- | Propellor/Attr.hs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Propellor/Attr.hs b/Propellor/Attr.hs index 94376b0d..d4fb25d2 100644 --- a/Propellor/Attr.hs +++ b/Propellor/Attr.hs @@ -10,36 +10,35 @@ import qualified Data.Set as S import qualified Data.Map as M import Control.Applicative -pureAttrProperty :: Desc -> (Attr -> Attr) -> AttrProperty -pureAttrProperty desc = AttrProperty $ Property ("has " ++ desc) - (return NoChange) +pureAttrProperty :: Desc -> (Attr -> Attr) -> Property +pureAttrProperty desc = Property ("has " ++ desc) (return NoChange) -hostname :: HostName -> AttrProperty +hostname :: HostName -> Property hostname name = pureAttrProperty ("hostname " ++ name) $ \d -> d { _hostname = name } getHostName :: Propellor HostName getHostName = asks _hostname -os :: System -> AttrProperty +os :: System -> Property os system = pureAttrProperty ("Operating " ++ show system) $ \d -> d { _os = Just system } getOS :: Propellor (Maybe System) getOS = asks _os -cname :: Domain -> AttrProperty +cname :: Domain -> Property cname domain = pureAttrProperty ("cname " ++ domain) (addCName domain) -cnameFor :: IsProp p => Domain -> (Domain -> p) -> AttrProperty +cnameFor :: Domain -> (Domain -> Property) -> Property cnameFor domain mkp = let p = mkp domain - in AttrProperty p (addCName domain) + in p { propertyAttr = propertyAttr p . addCName domain } addCName :: HostName -> Attr -> Attr addCName domain d = d { _cnames = S.insert domain (_cnames d) } -sshPubKey :: String -> AttrProperty +sshPubKey :: String -> Property sshPubKey k = pureAttrProperty ("ssh pubkey known") $ \d -> d { _sshPubKey = Just k } |
