summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-07-11 07:39:02 -0700
committerGitHub <noreply@github.com>2017-07-11 07:39:02 -0700
commit29c32c37e99fcc28f961bc30c788e45d1e1f2a17 (patch)
tree5003b0750c9bffc16fb6f8d0d3d05e589b2c7b2e
parente98d3bd8847684e12cb7ac1e06d9930d8cd6902a (diff)
parent73407bd5c123feb17414e8b483009a90324f6405 (diff)
downloadohai-29c32c37e99fcc28f961bc30c788e45d1e1f2a17.tar.gz
Merge pull request #1030 from chef/jsinha/cherry-pick_solaris2_network_fix
Jsinha/cherry pick solaris2 network fix
-rw-r--r--lib/ohai/plugins/solaris2/network.rb3
-rw-r--r--spec/unit/plugins/solaris2/network_spec.rb9
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/ohai/plugins/solaris2/network.rb b/lib/ohai/plugins/solaris2/network.rb
index c13e5ffc..93231bac 100644
--- a/lib/ohai/plugins/solaris2/network.rb
+++ b/lib/ohai/plugins/solaris2/network.rb
@@ -103,7 +103,8 @@ Ohai.plugin(:Network) do
cint = nil
so.stdout.lines do |line|
- if line =~ /^([0-9a-zA-Z\.\:\-]+)\S/
+ # regex: http://rubular.com/r/Iag7JLVTVe
+ if line =~ /^([0-9a-zA-Z\.\:\-]+): \S+ mtu (\d+) index (\d+)/
cint = $1
iface[cint] = Mash.new unless iface[cint]
iface[cint][:mtu] = $2
diff --git a/spec/unit/plugins/solaris2/network_spec.rb b/spec/unit/plugins/solaris2/network_spec.rb
index 3755c183..43570741 100644
--- a/spec/unit/plugins/solaris2/network_spec.rb
+++ b/spec/unit/plugins/solaris2/network_spec.rb
@@ -69,9 +69,7 @@ lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
eri0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 \
index 2
inet 172.17.128.208 netmask ffffff00 broadcast 172.17.128.255
-ip6.tun0: flags=10008d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST,IPv4> \
-mtu 1460
- index 3
+ip6.tun0: flags=10008d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST,IPv4> mtu 1460 index 3
inet6 tunnel src fe80::1 tunnel dst fe80::2
tunnel security settings --> use 'ipsecconf -ln -i ip.tun1'
tunnel hop limit 60 tunnel encapsulation limit 4
@@ -80,8 +78,7 @@ qfe1: flags=2000841<UP,RUNNING,MULTICAST,IPv6> mtu 1500 index 3
usesrc vni0
inet6 fe80::203:baff:fe17:4be0/10
ether 0:3:ba:17:4b:e0
-vni0: flags=2002210041<UP,RUNNING,NOXMIT,NONUD,IPv6,VIRTUAL> mtu 0
- index 5
+vni0: flags=2002210041<UP,RUNNING,NOXMIT,NONUD,IPv6,VIRTUAL> mtu 1460 index 5
srcof qfe1
inet6 fe80::203:baff:fe17:4444/128
ENDIFCONFIG
@@ -176,7 +173,7 @@ ROUTE_GET
end
it "finds the default interface for a solaris 11 zone" do
- expect(@plugin[:network][:default_interface]).to eq("net1")
+ expect(@plugin[:network][:default_interface]).to eq("net1:1")
end
end