specinfra 2.11.4 → 2.11.5

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: 2aacdf6b994a79f02d4157a364bcf4ba47c90ca0
4
- data.tar.gz: 59364cf037cf07ae4869da6972602c720ed6d9cd
3
+ metadata.gz: 705f64c5443fd691f24ab9abb7ba9fa16f130db6
4
+ data.tar.gz: 6431a874a82046901a43ed5e4e9e56afd4cd8dff
5
5
  SHA512:
6
- metadata.gz: e24ca3bf76141ed96f90124cec7e92db7661b140d251d22590d43cf033ff990707feb5b3ed8a94aae80d3474fe6e1b2975d3f57a8f3251a4fdd757e686cfa165
7
- data.tar.gz: 5099f90bf58fb356dadbd01286248f60bed6eb80af824640fe6af6a28de02762ac5e52fb7e9df52319b1182f7a48fa205f886e555fdd532b9d26190192df3d63
6
+ metadata.gz: 8e58430ecb3ffee31460c561918bdc03517138adaeab30ef2eb19548123b660bd90e452d996204adea5a4250c0d3f30d19e2569144c90dfee9519c8abcc7b97c
7
+ data.tar.gz: d76edde501300a5cbdf0efc423bd84dc275cd9ae4cfea2f3941ad81e504ca01a451f2ff4b5f3600ad5331acff69277a42661cb4e132ef1003031af44d2b9ace8
@@ -1,7 +1,7 @@
1
1
  class Specinfra::Command::Base::RoutingTable < Specinfra::Command::Base
2
2
  class << self
3
3
  def check_has_entry(destination)
4
- "ip route | grep -E '^#{destination} '"
4
+ "ip route show #{destination} | grep #{destination}"
5
5
  end
6
6
 
7
7
  alias :get_entry :check_has_entry
@@ -133,12 +133,34 @@ module Specinfra
133
133
  :interface => expected_attr[:interface] ? $3 : nil
134
134
  }
135
135
  else
136
- ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+\n(?:default via (\S+))?/
137
- actual_attr = {
138
- :destination => $1,
139
- :gateway => $2 ? $2 : $4,
140
- :interface => expected_attr[:interface] ? $3 : nil
141
- }
136
+ matches = ret.stdout.scan(/^(\S+)(?: via (\S+))? dev (\S+).+\n|^(\S+).+\n|\s+nexthop via (\S+)\s+dev (\S+).+/)
137
+ if matches.length > 1
138
+ # ECMP route
139
+ destination = nil
140
+ matches.each do |groups|
141
+ if groups[3]
142
+ destination = groups[3]
143
+ next
144
+ else
145
+ next unless expected_attr[:interface] == groups[5]
146
+ end
147
+
148
+ actual_attr = {
149
+ :destination => destination,
150
+ :gateway => groups[4],
151
+ :interface => groups[5]
152
+ }
153
+ end
154
+ elsif matches.length == 1
155
+ # Non-ECMP route
156
+ groups = matches[0]
157
+ actual_attr = {
158
+ :destination => groups[0],
159
+ :gateway => groups[1] ? groups[1] : groups[3],
160
+ :interface => expected_attr[:interface] ? groups[2] : nil
161
+ }
162
+ end
163
+
142
164
  end
143
165
 
144
166
  expected_attr.each do |key, val|
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.11.4"
2
+ VERSION = "2.11.5"
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.11.4
4
+ version: 2.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-15 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh