summaryrefslogtreecommitdiff
path: root/Propellor/Attr.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Propellor/Attr.hs')
-rw-r--r--Propellor/Attr.hs17
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 }