diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-01-08 22:51:09 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-01-08 22:51:09 -0400 |
| commit | 0c66be1aae4f4bda4db97891c8e20239821ad4b3 (patch) | |
| tree | 6c81fec3bc7fb12f87631a91b1821fb7ad4e403a /src/Propellor/Spin.hs | |
| parent | c4a1e61d264e2bbb944bf4b4338b6d537c44b5d5 (diff) | |
propellor spin
Diffstat (limited to 'src/Propellor/Spin.hs')
| -rw-r--r-- | src/Propellor/Spin.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs index a1035387..339428ba 100644 --- a/src/Propellor/Spin.hs +++ b/src/Propellor/Spin.hs @@ -112,8 +112,14 @@ getSshTarget target hst useip why = case headMaybe configips of Nothing -> return target Just ip -> do - warningMessage $ "DNS seems out of date for " ++ target ++ " (" ++ why ++ "); using IP address from configuration instead." - return ip + -- If we're being asked to run on the local host, + -- ignore DNS. + s <- takeWhile (/= '\n') <$> readProcess "hostname" ["-f"] + if s == target + then return target + else do + warningMessage $ "DNS seems out of date for " ++ target ++ " (" ++ why ++ "); using IP address from configuration instead." + return ip configips = map fromIPAddr $ mapMaybe getIPAddr $ S.toList $ _dns $ hostInfo hst |
