summaryrefslogtreecommitdiff
path: root/lib/ohai/plugins/openstack.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ohai/plugins/openstack.rb')
-rw-r--r--lib/ohai/plugins/openstack.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/ohai/plugins/openstack.rb b/lib/ohai/plugins/openstack.rb
index 305b7cb7..b7ac8973 100644
--- a/lib/ohai/plugins/openstack.rb
+++ b/lib/ohai/plugins/openstack.rb
@@ -15,22 +15,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'ohai/mixin/ec2_metadata'
+require "ohai/mixin/ec2_metadata"
Ohai.plugin(:Openstack) do
provides "openstack"
include Ohai::Mixin::Ec2Metadata
- def collect_openstack_metadata(addr = Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, api_version = '2013-04-04')
+ def collect_openstack_metadata(addr = Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, api_version = "2013-04-04")
path = "/openstack/#{api_version}/meta_data.json"
uri = "http://#{addr}#{path}"
begin
- response = http_client.get_response(URI.parse(uri),nil,nil)
+ response = http_client.get_response(URI.parse(uri), nil, nil)
case response.code
- when '200'
+ when "200"
FFI_Yajl::Parser.parse(response.body)
- when '404'
+ when "404"
Ohai::Log.debug("Encountered 404 response retreiving OpenStack specific metadata path: #{path} ; continuing.")
nil
else
@@ -44,20 +44,20 @@ Ohai.plugin(:Openstack) do
collect_data do
# Adds openstack Mash
- if hint?('openstack') || hint?('hp')
+ if hint?("openstack") || hint?("hp")
Ohai::Log.debug("ohai openstack")
- if can_metadata_connect?(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR,80)
+ if can_metadata_connect?(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80)
openstack Mash.new
Ohai::Log.debug("connecting to the OpenStack metadata service")
- fetch_metadata.each {|k, v| openstack[k] = v }
+ fetch_metadata.each { |k, v| openstack[k] = v }
- if hint?('hp')
- openstack['provider'] = 'hp'
+ if hint?("hp")
+ openstack["provider"] = "hp"
else
- openstack['provider'] = 'openstack'
+ openstack["provider"] = "openstack"
Ohai::Log.debug("connecting to the OpenStack specific metadata service")
- openstack['metadata'] = collect_openstack_metadata
+ openstack["metadata"] = collect_openstack_metadata
end
else