diff options
author | Chris Roberts <chrisroberts.code@gmail.com> | 2013-04-30 09:27:41 -0700 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-06-23 20:06:31 -0700 |
commit | 52ed9acbc5de6d5fb53333314408386d409b3667 (patch) | |
tree | 584197495abdc91e0cf40446ed9c53379adaebe9 | |
parent | 14e8dd46764f640875d4c052f3ce92cd3713c9c0 (diff) | |
download | ohai-52ed9acbc5de6d5fb53333314408386d409b3667.tar.gz |
Use vm metadata to check for rackspace provider
-rw-r--r-- | lib/ohai/plugins/rackspace.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/ohai/plugins/rackspace.rb b/lib/ohai/plugins/rackspace.rb index c52dfbed..89afc5d2 100644 --- a/lib/ohai/plugins/rackspace.rb +++ b/lib/ohai/plugins/rackspace.rb @@ -42,13 +42,27 @@ def has_rackspace_mac? false end +# Checks for rackspace provider attribute +# +# === Return +# true:: If rackspace provider attribute found +# false:: Otherwise +def has_rackspace_metadata? + status, stdout, stderr = run_command(:no_status_check => true, :command => "xenstore-read vm-data/provider_data/provider") + if status == 0 + stdout.strip.downcase == 'rackspace' + end +rescue Ohai::Exceptions::Exec + false +end + # Identifies the rackspace cloud # # === Return # true:: If the rackspace cloud can be identified # false:: Otherwise def looks_like_rackspace? - hint?('rackspace') || has_rackspace_mac? || has_rackspace_kernel? + hint?('rackspace') || has_rackspace_mac? || has_rackspace_kernel? || has_rackspace_metadata? end # Names rackspace ip address |