ohai 14.4.1 → 14.4.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa2998db0ed97fe69f873899ea65c666badc17e7365c34592f539ee628299d7e
|
4
|
+
data.tar.gz: 26d01af9bf5ba6d2e874ed050b4a54ae167d4d7fcfeb5262eb6a9fa8438cff9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b9c7a7d84321fcc138c270d6bc06055d2bc3f2cbb49043e1462261d9fe44a5c07049d0bc2c304d47808d383b99ae78c21b01ab2b8a34ad6094678d9cd0e2ebd
|
7
|
+
data.tar.gz: 3eef3a40fbae42dd73cde34434ecfaef6798873655a228465d86c6ec98c1607feb58baea8f7b16037ae7a04100b9b374cb0d58a4bc52bdf4f1bff8ff4937dbbe
|
@@ -424,7 +424,7 @@ Ohai.plugin(:Network) do
|
|
424
424
|
# ipv4/ipv6 routes are different enough that having a single algorithm to select the favored route for both creates unnecessary complexity
|
425
425
|
# this method attempts to deduce the route that is most important to the user, which is later used to deduce the favored values for {ip,mac,ip6}address
|
426
426
|
# we only consider routes that are default routes, or those routes that get us to the gateway for a default route
|
427
|
-
def
|
427
|
+
def favored_default_route_linux(routes, iface, default_route, family)
|
428
428
|
routes.select do |r|
|
429
429
|
if family[:name] == "inet"
|
430
430
|
# the route must have a source address
|
@@ -543,7 +543,7 @@ Ohai.plugin(:Network) do
|
|
543
543
|
logger.trace("Plugin Network: #{default_prefix}_gateway set to #{network["#{default_prefix}_gateway"]}")
|
544
544
|
|
545
545
|
# deduce the default route the user most likely cares about to pick {ip,mac,ip6}address below
|
546
|
-
favored_route =
|
546
|
+
favored_route = favored_default_route_linux(routes, iface, default_route, family)
|
547
547
|
|
548
548
|
# FIXME: This entire block should go away, and the network plugin should be the sole source of {ip,ip6,mac}address
|
549
549
|
|
@@ -54,7 +54,7 @@ Ohai.plugin(:Network) do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
# Returns interface code for an interface
|
57
|
-
#
|
57
|
+
#
|
58
58
|
# Interface Index (if present, Index otherwise) will be converted in hexadecimal format
|
59
59
|
#
|
60
60
|
# @param int_idx [String or nil] the interface index of interface
|
@@ -72,7 +72,7 @@ Ohai.plugin(:Network) do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
# Returns IPV4 address from list of addresses containing IPV4 and IPV6 formats
|
75
|
-
#
|
75
|
+
#
|
76
76
|
# @param addresses [Array<String>] List of addresses
|
77
77
|
#
|
78
78
|
# @return [String]
|
@@ -97,7 +97,7 @@ Ohai.plugin(:Network) do
|
|
97
97
|
#
|
98
98
|
# @return [Hash<:index, :interface_index, :default_ip_gateway, :ip_connection_metric>]
|
99
99
|
#
|
100
|
-
def
|
100
|
+
def favored_default_route_windows(configuration)
|
101
101
|
return nil unless configuration.is_a?(Hash)
|
102
102
|
config = configuration.dup
|
103
103
|
|
@@ -191,7 +191,7 @@ Ohai.plugin(:Network) do
|
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
194
|
-
if (route =
|
194
|
+
if (route = favored_default_route_windows(iface_config))
|
195
195
|
network[:default_gateway] = route[:default_ip_gateway]
|
196
196
|
network[:default_interface] = interface_code(route[:interface_index], route[:index])
|
197
197
|
end
|
data/lib/ohai/version.rb
CHANGED
@@ -80,7 +80,7 @@ describe Ohai::System, "Windows Network Plugin" do
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
describe "#
|
83
|
+
describe "#favored_default_route_windows" do
|
84
84
|
let(:interface1) do
|
85
85
|
{ "index" => 1,
|
86
86
|
"interface_index" => 1,
|
@@ -90,28 +90,28 @@ describe Ohai::System, "Windows Network Plugin" do
|
|
90
90
|
let(:iface_config) { { 1 => interface1 } }
|
91
91
|
context "When a hash is not passed" do
|
92
92
|
it "Returns nil" do
|
93
|
-
expect(plugin.
|
93
|
+
expect(plugin.favored_default_route_windows("Invalid")).to be_nil
|
94
94
|
end
|
95
95
|
end
|
96
96
|
context "When no interface is passed in Hash" do
|
97
97
|
it "Returns nil" do
|
98
|
-
expect(plugin.
|
98
|
+
expect(plugin.favored_default_route_windows({})).to be_nil
|
99
99
|
end
|
100
100
|
end
|
101
101
|
context "When an interface configuration is passed" do
|
102
102
|
context "without default_ip_gateway" do
|
103
103
|
it "Returns nil" do
|
104
104
|
interface1["default_ip_gateway"] = nil
|
105
|
-
expect(plugin.
|
105
|
+
expect(plugin.favored_default_route_windows(iface_config)).to be_nil
|
106
106
|
end
|
107
107
|
end
|
108
108
|
context "with default_ip_gateway" do
|
109
109
|
it "Returns a hash with details" do
|
110
|
-
expect(plugin.
|
111
|
-
expect(plugin.
|
110
|
+
expect(plugin.favored_default_route_windows(iface_config)).to be_a(Hash)
|
111
|
+
expect(plugin.favored_default_route_windows(iface_config)).not_to be_empty
|
112
112
|
end
|
113
113
|
it "Returns the default_gateway in IPV4 format" do
|
114
|
-
expect(plugin.
|
114
|
+
expect(plugin.favored_default_route_windows(iface_config)).to include(default_ip_gateway: "192.168.1.1")
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -127,10 +127,10 @@ describe Ohai::System, "Windows Network Plugin" do
|
|
127
127
|
2 => interface2 }
|
128
128
|
end
|
129
129
|
it "Returns the default route as least metric interface" do
|
130
|
-
expect(plugin.
|
130
|
+
expect(plugin.favored_default_route_windows(iface_config)).to include(interface_index: 1)
|
131
131
|
end
|
132
132
|
it "Returns its default_gateway in IPV4 format" do
|
133
|
-
expect(plugin.
|
133
|
+
expect(plugin.favored_default_route_windows(iface_config)).to include(default_ip_gateway: "192.168.1.1")
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.4.
|
4
|
+
version: 14.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|