Sha256: 7563d34af418aff59b878836d1a472208817b3714b27cbcc5c6d4d1f464d7093

Contents?: true

Size: 575 Bytes

Versions: 5

Compression:

Stored size: 575 Bytes

Contents

module Serverspec
  module Type
    class DefaultGateway < Base
      def ipaddress
        ret = @runner.run_command(commands.check_routing_table_has_entry('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_has_entry('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

5 entries across 5 versions & 1 rubygems

Version Path
serverspec-2.0.0.beta13 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta12 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta11 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta10 lib/serverspec/type/default_gateway.rb
serverspec-2.0.0.beta9 lib/serverspec/type/default_gateway.rb