diff options
author | Tim Smith <tsmith@chef.io> | 2017-07-10 20:59:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 20:59:01 -0700 |
commit | 0a4be45ddf251793d550f881cf7e5e3cc1b67be3 (patch) | |
tree | f18e084e937da7d6bcc98b60937bfd97186607f6 | |
parent | df4c1e7e5f2857ba0906814e2b86f7bb2707cbc1 (diff) | |
parent | 3a04fc7ae61766806a3074ff1df35dd7147cd9f2 (diff) | |
download | ohai-0a4be45ddf251793d550f881cf7e5e3cc1b67be3.tar.gz |
Merge pull request #1028 from chef/jsinha/solaris2_nework_fix
Fix solaris2 ipaddress attribute search
-rw-r--r-- | lib/ohai/plugins/solaris2/network.rb | 3 | ||||
-rw-r--r-- | spec/unit/plugins/solaris2/network_spec.rb | 9 |
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/ohai/plugins/solaris2/network.rb b/lib/ohai/plugins/solaris2/network.rb index 7dac5a55..233a9bbd 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 caa444dc..baa4febc 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 |