From f16234f7d84c87a9b1b2913bb0c350e7e7da2cee Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 23 Apr 2014 16:03:17 -0400 Subject: propellor spin --- Propellor/Property/Dns.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Propellor/Property') diff --git a/Propellor/Property/Dns.hs b/Propellor/Property/Dns.hs index e07d3710..45a69499 100644 --- a/Propellor/Property/Dns.hs +++ b/Propellor/Property/Dns.hs @@ -49,8 +49,9 @@ import Data.List -- -- 2. By looking for NS Records in the passed list of records. -- --- In either case, the secondary dns server Host should have an ipv4 --- property. +-- In either case, the secondary dns server Host should have an ipv4 and/or +-- ipv6 property defined. Propellor will warn if it cannot find the IP +-- address for any secondary. primary :: [Host] -> Domain -> SOA -> [(BindDomain, Record)] -> RevertableProperty primary hosts domain soa rs = RevertableProperty setup cleanup where @@ -63,14 +64,14 @@ primary hosts domain soa rs = RevertableProperty setup cleanup `requires` namedConfWritten `onChange` Service.reloaded "bind9" - (partialzone, warnings) = genZone hosts domain soa + (partialzone, zonewarnings) = genZone hosts domain soa zone = partialzone { zHosts = zHosts partialzone ++ rs } zonefile = "/etc/bind/propellor/db." ++ domain baseprop = Property ("dns primary for " ++ domain) (makeChange $ writeZoneFile zone zonefile) (addNamedConf conf) withwarnings p = adjustProperty p $ \satisfy -> do - mapM_ warningMessage warnings + mapM_ warningMessage $ zonewarnings ++ secondarywarnings satisfy conf = NamedConf { confDomain = domain @@ -78,11 +79,13 @@ primary hosts domain soa rs = RevertableProperty setup cleanup , confFile = zonefile , confMasters = [] , confAllowTransfer = nub $ - concatMap (\m -> hostAddresses m hosts) $ - otherServers Secondary hosts domain ++ - mapMaybe (domainHostName <=< getNS) rootRecords + concatMap (\h -> hostAddresses h hosts) secondaries , confLines = [] } + secondaries = otherServers Secondary hosts domain ++ + mapMaybe (domainHostName <=< getNS) rootRecords + secondarywarnings = map (\h -> "No IP address defined for DNS seconary " ++ h) $ + filter (\h -> null (hostAddresses h hosts)) secondaries rootRecords = map snd $ filter (\(d, _r) -> d == RootDomain || d == AbsDomain domain) rs needupdate = do -- cgit v1.2.3