Merge branch 'joeyconfig'

Conflicts:
	src/Propellor/Property/Dns.hs
This commit is contained in:
Joey Hess 2015-01-04 21:32:30 -04:00
commit 0235e88ea2
1 changed files with 6 additions and 6 deletions

View File

@ -80,7 +80,7 @@ setupPrimary zonefile mknamedconffile hosts domain soa rs =
baseprop = Property ("dns primary for " ++ domain) satisfy baseprop = Property ("dns primary for " ++ domain) satisfy
(addNamedConf conf) (addNamedConf conf)
satisfy = do satisfy = do
sshfps <- concat <$> mapM (genSSHFP domain) indomain sshfps <- concat <$> mapM (genSSHFP domain) (M.elems hostmap)
let zone = partialzone let zone = partialzone
{ zHosts = zHosts partialzone ++ rs ++ sshfps } { zHosts = zHosts partialzone ++ rs ++ sshfps }
ifM (liftIO $ needupdate zone) ifM (liftIO $ needupdate zone)
@ -510,8 +510,8 @@ addNamedConf conf = mempty { _namedconf = NamedConfMap (M.singleton domain conf)
getNamedConf :: Propellor (M.Map Domain NamedConf) getNamedConf :: Propellor (M.Map Domain NamedConf)
getNamedConf = asks $ fromNamedConfMap . _namedconf . hostInfo getNamedConf = asks $ fromNamedConfMap . _namedconf . hostInfo
-- | Generates SSHFP records for hosts that have configured -- | Generates SSHFP records for hosts in the domain (or with CNAMES
-- ssh public keys. -- in the domain) that have configured ssh public keys.
-- --
-- This is done using ssh-keygen, so sadly needs IO. -- This is done using ssh-keygen, so sadly needs IO.
genSSHFP :: Domain -> Host -> Propellor [(BindDomain, Record)] genSSHFP :: Domain -> Host -> Propellor [(BindDomain, Record)]
@ -519,9 +519,9 @@ genSSHFP domain h = concatMap mk . concat <$> (gen =<< get)
where where
get = fromHost [h] hostname Ssh.getPubKey get = fromHost [h] hostname Ssh.getPubKey
gen = liftIO . mapM genSSHFP' . M.elems . fromMaybe M.empty gen = liftIO . mapM genSSHFP' . M.elems . fromMaybe M.empty
mk r = map (\d -> (d, r)) (AbsDomain hostname : cnames) mk r = mapMaybe (\d -> if inDomain domain d then Just (d, r) else Nothing)
cnames = filter (inDomain domain) $ (AbsDomain hostname : cnames)
mapMaybe getCNAME $ S.toList $ _dns info cnames = mapMaybe getCNAME $ S.toList $ _dns info
hostname = hostName h hostname = hostName h
info = hostInfo h info = hostInfo h