From 4e4fb9ab7ca13f5148c6d4b08f53f518429530a8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 18 Apr 2014 03:59:06 -0400 Subject: get rid of AttrProperty Now both Property and RevertableProperty can influence Attr on their own. --- Propellor/Attr.hs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Propellor/Attr.hs') 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 } -- cgit v1.2.3