summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcuriositycasualty <isa@getchef.com>2015-03-30 11:36:47 -0700
committercuriositycasualty <isa@getchef.com>2015-03-30 11:36:47 -0700
commitf5e283c74fc5699731715a9ce7958c9e6145cb10 (patch)
tree54e9f2746f749226cfc415c8982ebe483d202b01
parent27350291b2c708189569eaa668deabc7bc96cf45 (diff)
downloadohai-if/solaris11-root-ipaddress.tar.gz
populate ipaddress correctly within zonesif/solaris11-root-ipaddress
-rw-r--r--lib/ohai/plugins/solaris2/network.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ohai/plugins/solaris2/network.rb b/lib/ohai/plugins/solaris2/network.rb
index 7e4e445b..b2db8df6 100644
--- a/lib/ohai/plugins/solaris2/network.rb
+++ b/lib/ohai/plugins/solaris2/network.rb
@@ -150,10 +150,17 @@ Ohai.plugin(:Network) do
so = shell_out("route -n get default")
so.stdout.lines do |line|
- matches = /interface: (\S+)/.match(line)
+ matches = /interface: (?<def_route_interface>\S+)/.match(line)
if matches
+ # Within a zone, `route -n get default` will produce the zonehost's
+ # interface name ("net0"), not the zone's specific iteration of it ("net0:3").
+ # This pairs the two and allows node['ipaddress'] to be populated correctly
+ # by the default network.rb plugin.
+ actual_default_interface = network[:interfaces].select do |v, vi|
+ v.include? matches[:def_route_interface]
+ end
Ohai::Log.debug("found gateway device: #{$1}")
- network[:default_interface] = matches[1]
+ network[:default_interface] = actual_default_interface.keys.first
end
matches = /gateway: (\S+)/.match(line)
if matches