Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[OHAI-461] Add rackspace networks if available #136

Closed
wants to merge 1 commit into from

2 participants

Chris Roberts Serdar Sutay
Chris Roberts

No description provided.

Serdar Sutay
Owner

A similar logic went into Ohai 7 @chrisroberts. Let us know if this is still an issue for you:

78fa9d0

Serdar Sutay sersut closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 17, 2013
  1. Chris Roberts
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/ohai/plugins/rackspace.rb
17 lib/ohai/plugins/rackspace.rb
View
@@ -93,6 +93,22 @@ def get_region()
Ohai::Log.debug("Unable to find xenstore-ls, cannot capture region information for Rackspace cloud")
end
+def get_networks
+ status, stdout, stderr = run_command(:no_status_check => true, :command => 'xenstore-ls vm-data/networking')
+ if status == 0
+ stdout.split("\n").map{|l| l.split('=').first.strip }.map do |item|
+ _status, _stdout, _stderr = run_command(:no_status_check => true, :command => "xenstore-read vm-data/networking/#{item}")
+ if status == 0
+ Yajl::Parser.new.parse(_stdout)
+ else
+ raise Ohai::Exceptions::Exec
+ end
+ end
+ end
+rescue Ohai::Exceptions::Exec
+ Ohai::Log.debug('Unable to capture custom private networking information for Rackspace cloud')
+end
+
# Adds rackspace Mash
if looks_like_rackspace?
rackspace Mash.new
@@ -106,4 +122,5 @@ def get_region()
rackspace[:local_ipv4] = rackspace[:private_ip]
get_global_ipv6_address(:local_ipv6, :eth1)
rackspace[:local_hostname] = hostname
+ rackspace[:networks] = get_networks
end
Something went wrong with that request. Please try again.