summaryrefslogtreecommitdiff
path: root/src/Propellor/Attr.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Attr.hs')
-rw-r--r--src/Propellor/Attr.hs13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/Propellor/Attr.hs b/src/Propellor/Attr.hs
index e2b64bf0..6bc4fcf1 100644
--- a/src/Propellor/Attr.hs
+++ b/src/Propellor/Attr.hs
@@ -83,22 +83,17 @@ sshPubKey k = pureAttrProperty ("ssh pubkey known") $
getSshPubKey :: Propellor (Maybe String)
getSshPubKey = asks _sshPubKey
-hostnameless :: Attr
-hostnameless = newAttr (error "hostname Attr not specified")
-
hostAttr :: Host -> Attr
-hostAttr (Host _ mkattrs) = mkattrs hostnameless
+hostAttr (Host hn _ mkattrs) = mkattrs (newAttr hn)
hostProperties :: Host -> [Property]
-hostProperties (Host ps _) = ps
+hostProperties (Host _ ps _) = ps
hostMap :: [Host] -> M.Map HostName Host
-hostMap l = M.fromList $ zip (map (_hostname . hostAttr) l) l
+hostMap l = M.fromList $ zip (map _hostName l) l
hostAttrMap :: [Host] -> M.Map HostName Attr
-hostAttrMap l = M.fromList $ zip (map _hostname attrs) attrs
- where
- attrs = map hostAttr l
+hostAttrMap l = M.fromList $ zip (map _hostName l) (map hostAttr l)
findHost :: [Host] -> HostName -> Maybe Host
findHost l hn = M.lookup hn (hostMap l)