Method: Specinfra::Command::Darwin::Base::Interface.check_has_ipv4_address
- Defined in:
- lib/specinfra/command/darwin/base/interface.rb
permalink .check_has_ipv4_address(interface, ip_address) ⇒ Object
[View source]
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/specinfra/command/darwin/base/interface.rb', line 7 def check_has_ipv4_address(interface, ip_address) ip_address = ip_address.dup if ip_address =~ /\/\d+$/ # remove the prefix - better would be to calculate the netmask ip_address.gsub!(/\/\d+$/, "") end ip_address << " " ip_address.gsub!(".", "\\.") "ifconfig #{interface} inet | grep 'inet #{ip_address}'" end |