summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
authorJoey Hess2015-01-01 13:36:51 -0400
committerJoey Hess2015-01-01 13:36:51 -0400
commitf3f60a74c47ee837331f24b3541596deda97169c (patch)
treee17e2b002bb9b7155960c8dbf8a3860d13719289 /src/Propellor
parentb059ae4c77bca559ea25de2ee4eaa4a67dd55a75 (diff)
propellor spin
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/Spin.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs
index 476cb1a4..c2fde99e 100644
--- a/src/Propellor/Spin.hs
+++ b/src/Propellor/Spin.hs
@@ -100,15 +100,19 @@ getSshTarget target hst
| otherwise = return target
where
go (Left e) = useip (show e)
- go (Right hostentry) = maybe (useip $ "none matching " ++ fromMaybe "missing" configip) (const $ return target)
- =<< firstM matchingtarget (BSD.hostAddresses hostentry)
+ go (Right hostentry) = ifM (anyM matchingtarget (BSD.hostAddresses hostentry))
+ ( return target
+ , do
+ ips <- mapM inet_ntoa (BSD.hostAddresses hostentry)
+ useip ("DNS " ++ show ips ++ " /= configured " ++ show (maybeToList configip))
+ )
matchingtarget a = (==) target <$> inet_ntoa a
useip why = case configip of
Nothing -> return target
Just ip -> do
- warningMessage $ "DNS seems out of date for " ++ target ++ "(" ++ why ++ "); using IP address from configuration instead."
+ warningMessage $ "DNS seems out of date for " ++ target ++ " (" ++ why ++ "); using IP address from configuration instead."
return ip
configip = case mapMaybe getIPAddr (S.toList (_dns (hostInfo hst))) of