lg / murder

Large scale server deploys using BitTorrent and the BitTornado library (NOTE: project no longer maintained)
http://twitter.com
Other
2.53k stars 269 forks source link

IP address fix #3

Closed robinbowes closed 13 years ago

robinbowes commented 13 years ago

host can (and does) return multiple lines, eg:

host b001

b001.example.com has address 192.168.55.121 b001.example.com mail is handled by 0 mail.example.com.

and

host puppet

puppet.example.com is an alias for puppet.b.example.com. puppet.b.example.com has address 192.168.55.240

This commit makes sure that any lines not containing an IP address are ignored and that only the first IP address is used (if more than one is returned).

See also http://github.com/robinbowes/murder/commit/d457e7b0c5555dc0c56ca90ccd36e8813e8f9768 which makes this technique a little more robust by setting the language before running the "host" command.

lg commented 13 years ago

just cherrypicked your changes into lg/murder. thank you for your contributions Robin!