From c742c2eb1b7141fbe0628870e899d3461a88686a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 May 2014 17:22:35 -0400 Subject: propellor spin --- src/Propellor/Attr.hs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/Propellor/Attr.hs') 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) -- cgit v1.3-2-g0d8e