summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2015-01-01 13:34:02 -0400
committerJoey Hess2015-01-01 13:34:02 -0400
commitb059ae4c77bca559ea25de2ee4eaa4a67dd55a75 (patch)
treea9dd1753102aa15eb6b45a3e98793a3c7461564c /src
parent72b7b0652577b5c454687ed576606023ba8f7386 (diff)
propellor spin
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Spin.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs
index 67fa7c58..476cb1a4 100644
--- a/src/Propellor/Spin.hs
+++ b/src/Propellor/Spin.hs
@@ -96,19 +96,19 @@ spin target relay hst = do
-- the host in it at all, use one of the Host's IPs instead.
getSshTarget :: HostName -> Host -> IO String
getSshTarget target hst
- | isJust configip = go =<< catchMaybeIO (BSD.getHostByName target)
+ | isJust configip = go =<< tryIO (BSD.getHostByName target)
| otherwise = return target
where
- go Nothing = useip
- go (Just hostentry) = maybe useip (const $ return target)
+ go (Left e) = useip (show e)
+ go (Right hostentry) = maybe (useip $ "none matching " ++ fromMaybe "missing" configip) (const $ return target)
=<< firstM matchingtarget (BSD.hostAddresses hostentry)
matchingtarget a = (==) target <$> inet_ntoa a
- useip = case configip of
+ useip why = case configip of
Nothing -> return target
Just ip -> do
- warningMessage $ "DNS seems out of date for " ++ target ++ "; 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