diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-01-15 14:03:50 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-01-15 14:03:50 -0400 |
| commit | 47fdb99fbba21f724a2cb6e909c3801e3cc7ab22 (patch) | |
| tree | 6b97363e81def50d20a1e5aefb6a2a2519bfdcfa /src/Propellor/Spin.hs | |
| parent | 16031a7c26464485e7c11afdec7d0b80dfe2f5bf (diff) | |
| parent | 35cd06e4e6cad5bc6c9bbbd33642450dbd2de10c (diff) | |
Merge branch 'joeyconfig'
Conflicts:
privdata.joey/privdata.gpg
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 |
