Method: Specinfra::Command::Darwin::Base::Host.get_ipaddress
- Defined in:
- lib/specinfra/command/darwin/base/host.rb
.get_ipaddress(name) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/specinfra/command/darwin/base/host.rb', line 23 def get_ipaddress(name) # If the query returns multiple records the most likey match is returned. # Generally this means IPv6 wins over IPv4. %Q{dscacheutil -q host -a name #{escape(name)} | } + %Q{awk '/^ipv6_/{ ip = $2 }; /^$/{ exit }; /^ip_/{ ip = $2; exit}; END{ print ip }'} end |