summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ray <matthewhray@gmail.com>2012-11-09 17:10:09 -0600
committerBryan McLellan <btm@opscode.com>2012-12-06 13:05:23 -0800
commitfd671c0e657ffd586f003328fb255b6f3c5d0dd1 (patch)
tree29fcd39f0d270079b068ccc589d6baa72b6769fe
parent2181511bf4d6696f4fcc45be68e3e668abcd36f0 (diff)
downloadohai-fd671c0e657ffd586f003328fb255b6f3c5d0dd1.tar.gz
add support for identifying Rackspace, HP or vanilla OpenStack
-rw-r--r--lib/ohai/plugins/cloud.rb2
-rw-r--r--lib/ohai/plugins/openstack.rb10
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/ohai/plugins/cloud.rb b/lib/ohai/plugins/cloud.rb
index 0bb2efe0..a189541b 100644
--- a/lib/ohai/plugins/cloud.rb
+++ b/lib/ohai/plugins/cloud.rb
@@ -169,7 +169,7 @@ def get_openstack_values
cloud[:public_hostname] = openstack['public_hostname']
cloud[:local_ipv4] = openstack['local_ipv4']
cloud[:local_hostname] = openstack['local_hostname']
- cloud[:provider] = "openstack"
+ cloud[:provider] = openstack['provider']
end
# setup openstack cloud
diff --git a/lib/ohai/plugins/openstack.rb b/lib/ohai/plugins/openstack.rb
index 949c7c4e..d6b0f31a 100644
--- a/lib/ohai/plugins/openstack.rb
+++ b/lib/ohai/plugins/openstack.rb
@@ -25,13 +25,21 @@ extend Ohai::Mixin::Ec2Metadata
#Ec2Metadata::EC2_METADATA_URL = "/latest/meta-data"
# Adds openstack Mash
-if hint?('openstack')
+if hint?('openstack') || hint?('hp')
Ohai::Log.debug("ohai openstack")
openstack Mash.new
#for now, use the metadata service
if can_metadata_connect?(EC2_METADATA_ADDR,80)
Ohai::Log.debug("connecting to the OpenStack metadata service")
self.fetch_metadata.each {|k, v| openstack[k] = v }
+ case
+ when hint?('hp')
+ openstack['provider'] = 'hp'
+ when hint?('rackspace')
+ openstack['provider'] = 'rackspace'
+ else
+ openstack['provider'] = 'openstack'
+ end
else
Ohai::Log.debug("unable to connect to the OpenStack metadata service")
end