summaryrefslogtreecommitdiff
path: root/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-04-23 16:03:17 -0400
committerJoey Hess2014-04-23 16:03:17 -0400
commitf16234f7d84c87a9b1b2913bb0c350e7e7da2cee (patch)
tree974c2a7b01b34f7bfb341bf3bcf931cc1663a1fd /Propellor/Property
parent34c7a1406018ce1566a09f8823a2aeee16f1505a (diff)
propellor spin
Diffstat (limited to 'Propellor/Property')
-rw-r--r--Propellor/Property/Dns.hs17
1 files changed, 10 insertions, 7 deletions
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