specinfra 2.0.0.beta49 → 2.0.0.beta50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/specinfra/command/openbsd/base/routing_table.rb +1 -1
- data/lib/specinfra/processor.rb +21 -1
- data/lib/specinfra/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84744a7a631801a67ee1cb4357dc3b19be41c06f
|
4
|
+
data.tar.gz: 85a4c8ca8abdb1de2c532bbfc6a54d4aa994e3df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 '
|
4
|
+
"route -n show -gateway | egrep '^#{destination}' | head -1"
|
5
5
|
end
|
6
6
|
|
7
7
|
alias :get_entry :check_has_entry
|
data/lib/specinfra/processor.rb
CHANGED
@@ -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
|
data/lib/specinfra/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|