propellor spin
This commit is contained in:
parent
34c7a14060
commit
f16234f7d8
|
@ -49,8 +49,9 @@ import Data.List
|
||||||
--
|
--
|
||||||
-- 2. By looking for NS Records in the passed list of records.
|
-- 2. By looking for NS Records in the passed list of records.
|
||||||
--
|
--
|
||||||
-- In either case, the secondary dns server Host should have an ipv4
|
-- In either case, the secondary dns server Host should have an ipv4 and/or
|
||||||
-- property.
|
-- ipv6 property defined. Propellor will warn if it cannot find the IP
|
||||||
|
-- address for any secondary.
|
||||||
primary :: [Host] -> Domain -> SOA -> [(BindDomain, Record)] -> RevertableProperty
|
primary :: [Host] -> Domain -> SOA -> [(BindDomain, Record)] -> RevertableProperty
|
||||||
primary hosts domain soa rs = RevertableProperty setup cleanup
|
primary hosts domain soa rs = RevertableProperty setup cleanup
|
||||||
where
|
where
|
||||||
|
@ -63,14 +64,14 @@ primary hosts domain soa rs = RevertableProperty setup cleanup
|
||||||
`requires` namedConfWritten
|
`requires` namedConfWritten
|
||||||
`onChange` Service.reloaded "bind9"
|
`onChange` Service.reloaded "bind9"
|
||||||
|
|
||||||
(partialzone, warnings) = genZone hosts domain soa
|
(partialzone, zonewarnings) = genZone hosts domain soa
|
||||||
zone = partialzone { zHosts = zHosts partialzone ++ rs }
|
zone = partialzone { zHosts = zHosts partialzone ++ rs }
|
||||||
zonefile = "/etc/bind/propellor/db." ++ domain
|
zonefile = "/etc/bind/propellor/db." ++ domain
|
||||||
baseprop = Property ("dns primary for " ++ domain)
|
baseprop = Property ("dns primary for " ++ domain)
|
||||||
(makeChange $ writeZoneFile zone zonefile)
|
(makeChange $ writeZoneFile zone zonefile)
|
||||||
(addNamedConf conf)
|
(addNamedConf conf)
|
||||||
withwarnings p = adjustProperty p $ \satisfy -> do
|
withwarnings p = adjustProperty p $ \satisfy -> do
|
||||||
mapM_ warningMessage warnings
|
mapM_ warningMessage $ zonewarnings ++ secondarywarnings
|
||||||
satisfy
|
satisfy
|
||||||
conf = NamedConf
|
conf = NamedConf
|
||||||
{ confDomain = domain
|
{ confDomain = domain
|
||||||
|
@ -78,11 +79,13 @@ primary hosts domain soa rs = RevertableProperty setup cleanup
|
||||||
, confFile = zonefile
|
, confFile = zonefile
|
||||||
, confMasters = []
|
, confMasters = []
|
||||||
, confAllowTransfer = nub $
|
, confAllowTransfer = nub $
|
||||||
concatMap (\m -> hostAddresses m hosts) $
|
concatMap (\h -> hostAddresses h hosts) secondaries
|
||||||
otherServers Secondary hosts domain ++
|
|
||||||
mapMaybe (domainHostName <=< getNS) rootRecords
|
|
||||||
, confLines = []
|
, 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 $
|
rootRecords = map snd $
|
||||||
filter (\(d, _r) -> d == RootDomain || d == AbsDomain domain) rs
|
filter (\(d, _r) -> d == RootDomain || d == AbsDomain domain) rs
|
||||||
needupdate = do
|
needupdate = do
|
||||||
|
|
Loading…
Reference in New Issue