/usr/lib/ruby/vendor_ruby/specinfra/command/linux/base/interface.rb is in ruby-specinfra 2.35.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | class Specinfra::Command::Linux::Base::Interface < Specinfra::Command::Base::Interface
class << self
def check_exists(name)
"ip link show #{name}"
end
def get_speed_of(name)
"cat /sys/class/net/#{name}/speed"
end
def check_has_ipv4_address(interface, ip_address)
ip_address = ip_address.dup
if ip_address =~ /\/\d+$/
ip_address << " "
else
ip_address << "/"
end
ip_address.gsub!(".", "\\.")
"ip addr show #{interface} | grep 'inet #{ip_address}'"
end
def check_has_ipv6_address(interface, ip_address)
ip_address = ip_address.dup
if ip_address =~ /\/\d+$/
ip_address << " "
else
ip_address << "/"
end
ip_address.downcase!
"ip addr show #{interface} | grep 'inet6 #{ip_address}'"
end
def get_link_state(name)
"cat /sys/class/net/#{name}/operstate"
end
end
end
|