Method: Specinfra::Command::Openbsd::Base::Interface.check_has_ipv4_address
- Defined in:
- lib/specinfra/command/openbsd/base/interface.rb
permalink .check_has_ipv4_address(interface, ip_address) ⇒ Object
[View source]
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/specinfra/command/openbsd/base/interface.rb', line 11 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 |