Sha256: 4953d08abdd66c8820083f8b31c71be1626e1439631dc25a64024d7083047209

Contents?: true

Size: 929 Bytes

Versions: 50

Compression:

Stored size: 929 Bytes

Contents

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

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
specinfra-2.40.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.39.1 lib/specinfra/command/linux/base/interface.rb
specinfra-2.39.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.38.1 lib/specinfra/command/linux/base/interface.rb
specinfra-2.38.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.9 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.8 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.6 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.5 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.4 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.3 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.2 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.1 lib/specinfra/command/linux/base/interface.rb
specinfra-2.37.0 lib/specinfra/command/linux/base/interface.rb
specinfra-2.36.18 lib/specinfra/command/linux/base/interface.rb
specinfra-2.36.17 lib/specinfra/command/linux/base/interface.rb
specinfra-2.36.16 lib/specinfra/command/linux/base/interface.rb
specinfra-2.36.15 lib/specinfra/command/linux/base/interface.rb
specinfra-2.36.14 lib/specinfra/command/linux/base/interface.rb
specinfra-2.36.13 lib/specinfra/command/linux/base/interface.rb