summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsspans <sten@blinkenlights.nl>2014-06-23 15:56:47 +0200
committerBryan McLellan <btm@opscode.com>2015-02-17 11:46:32 -0500
commit0a5332b84777c83a5dbdb59f7f0a3b015bdbe287 (patch)
tree0bbf5a8d319cf19cd1e6ba7ae065675fe74b45c5
parent1ef15210695f08ee294f8ef73d08484b54b4b069 (diff)
downloadohai-0a5332b84777c83a5dbdb59f7f0a3b015bdbe287.tar.gz
Fix network.rb for XenServer Creedence Alpha
On the current alpha versions of xenserver the "ip addr" command skips "physical" interfaces, however "ip -d -s link" does list all interfaces. This causes network.rb to fail on line 177 - because it tries to add state for an undefined interface. The easiest fix is to create the iface[tmp_int] entry when we encounter a new interface during the parsing of "ip -d -s link". With this fix chef-client is again usable on XenServer. Further debug output available on request.
-rw-r--r--lib/ohai/plugins/linux/network.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/ohai/plugins/linux/network.rb b/lib/ohai/plugins/linux/network.rb
index c6fa8859..d550a9da 100644
--- a/lib/ohai/plugins/linux/network.rb
+++ b/lib/ohai/plugins/linux/network.rb
@@ -137,6 +137,7 @@ Ohai.plugin(:Network) do
so.stdout.lines do |line|
if line =~ IPROUTE_INT_REGEX
tmp_int = $2
+ iface[tmp_int] = Mash.new unless iface[tmp_int]
net_counters[tmp_int] = Mash.new unless net_counters[tmp_int]
end