Sha256: 9570d6f4d07fa3c2697fb8167504fcbfdb594fa19dee032dd347a97585a1f492

Contents?: true

Size: 551 Bytes

Versions: 6

Compression:

Stored size: 551 Bytes

Contents

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

      def interface
        ret = @runner.get_routing_table_entry(:destination => '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.beta19 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta18 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta17 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta16 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta15 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta14 lib/serverspec/type/default_gateway.rb