Sha256: 2d0d4d6b95ff4df63ec9c878288a89f6981f35978a61153b2a5dec666195958b

Contents?: true

Size: 555 Bytes

Versions: 6

Compression:

Stored size: 555 Bytes

Contents

module Serverspec
  module Type
    class DefaultGateway < Base
      def ipaddress
        ret = @runner.run_command(commands.check_routing_table('default'))
        ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
        $2 ? $2 : $4
      end

      def interface
        ret = @runner.run_command(commands.check_routing_table('default'))
        ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
        $3
      end

      def to_s
        'Default Gateway'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
serverspec-2.0.0.beta8 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta7 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta6 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta5 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta4 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta3 lib/serverspec/type/default_gateway.rb