specinfra 2.0.0.beta49 → 2.0.0.beta50

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57c43910f7e3383297771e203b9487ac3832ce66
4
- data.tar.gz: b3c1c7ca91123663db49c35409ac0a7a25349c8a
3
+ metadata.gz: 84744a7a631801a67ee1cb4357dc3b19be41c06f
4
+ data.tar.gz: 85a4c8ca8abdb1de2c532bbfc6a54d4aa994e3df
5
5
  SHA512:
6
- metadata.gz: 30552786b192a05a2b4ce8c21959561c62e238d3e05f42150373a82788a9b2dccd14732e590ca551b78a5a9dfee0795cb8abc9f9a4ced8cd00819edc203343ab
7
- data.tar.gz: 534f203f6b2fc78ac298a5169b95490aa4af0c5489e1ba060c8ba786f2d30ba6d0929dfff0e1cf47d311b05715e191d59f3d5bdd73144ff5171dedf6e972143e
6
+ metadata.gz: 5ebe9832eb880d67db5c597465cae89c4b1aec7251af8e119153d20eeca7ee300796fe9faf8b8e29fc9c91fc8239508ccc9a15e813e9c958eeabb5a844057240
7
+ data.tar.gz: 5c37468b41ed148f2512fc065b6f91125de428751ad5020fd51ba220ab4dd2869ab5e7535fb322f3d57d4af46c38dacd2a6b201cceb19ac386d620a2b789eb33
@@ -1,7 +1,7 @@
1
1
  class Specinfra::Command::Openbsd::Base::RoutingTable < Specinfra::Command::Base::RoutingTable
2
2
  class << self
3
3
  def check_has_entry(destination)
4
- "route -n show -gateway | egrep '(^default|#{destination})' | head -1"
4
+ "route -n show -gateway | egrep '^#{destination}' | head -1"
5
5
  end
6
6
 
7
7
  alias :get_entry :check_has_entry
@@ -124,7 +124,7 @@ module Specinfra
124
124
  ret.stdout.gsub!(/\r\n/, "\n")
125
125
 
126
126
  if os[:family] == 'openbsd'
127
- match = ret.stdout.match(/^(?<destination>\S+)\s+(?<gateway>\S+).*?(?<interface>\S+[0-9]+)$/)
127
+ match = ret.stdout.match(/^(?<destination>\S+)\s+(?<gateway>\S+).*?(?<interface>\S+[0-9]+)(\s*)$/)
128
128
  actual_attr = {
129
129
  :destination => match[:destination],
130
130
  :gateway => match[:gateway],
@@ -144,5 +144,25 @@ module Specinfra
144
144
  end
145
145
  true
146
146
  end
147
+
148
+ def self.get_default_gateway(attr)
149
+ cmd = Specinfra.command.get(:get_routing_table_entry, 'default')
150
+ ret = Specinfra.backend.run_command(cmd)
151
+ return false if ret.failure?
152
+
153
+ ret.stdout.gsub!(/\r\n/, "\n")
154
+
155
+ if os[:family] == 'openbsd'
156
+ match = ret.stdout.match(/^(?<destination>\S+)\s+(?<gateway>\S+).*?(?<interface>\S+[0-9]+)(\s*)$/)
157
+ match[attr]
158
+ else
159
+ ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+\n(?:default via (\S+))?/
160
+ if attr == :gateway
161
+ $2 ? $2 : $4
162
+ elsif attr == :interface
163
+ $3
164
+ end
165
+ end
166
+ end
147
167
  end
148
168
  end
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.0.0.beta49"
2
+ VERSION = "2.0.0.beta50"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta49
4
+ version: 2.0.0.beta50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-18 00:00:00.000000000 Z
11
+ date: 2014-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh