Sha256: 397506a13d97ba5969a20300793ad6717f0188370d2624e6cfc4053f3749f69c

Contents?: true

Size: 1.42 KB

Versions: 15

Compression:

Stored size: 1.42 KB

Contents

#
# Author:: Matt Ray (<matt@opscode.com>)
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

provides "openstack"

require 'ohai/mixin/ec2_metadata'

extend Ohai::Mixin::Ec2Metadata

# does it matter that it's not hitting latest?
#Ec2Metadata::EC2_METADATA_URL = "/latest/meta-data"

# Adds openstack Mash
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'
    else
      openstack['provider'] = 'openstack'
    end
  else
    Ohai::Log.debug("unable to connect to the OpenStack metadata service")
  end
else
  Ohai::Log.debug("NOT ohai openstack")
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ohai-6.24.2 lib/ohai/plugins/openstack.rb
ohai-6.24.0 lib/ohai/plugins/openstack.rb
ohai-6.24.0.rc.0 lib/ohai/plugins/openstack.rb
ohai-6.22.0 lib/ohai/plugins/openstack.rb
ohai-6.22.0.rc.0 lib/ohai/plugins/openstack.rb
ohai-6.20.0 lib/ohai/plugins/openstack.rb
ohai-6.20.0.rc.1 lib/ohai/plugins/openstack.rb
ohai-6.18.0 lib/ohai/plugins/openstack.rb
ohai-6.18.0.rc.4 lib/ohai/plugins/openstack.rb
ohai-6.18.0.rc.3 lib/ohai/plugins/openstack.rb
ohai-6.18.0.rc.1 lib/ohai/plugins/openstack.rb
ohai-6.18.0.rc.0 lib/ohai/plugins/openstack.rb
ohai-6.16.0 lib/ohai/plugins/openstack.rb
ohai-6.16.0.beta.2 lib/ohai/plugins/openstack.rb
ohai-6.16.0.beta.1 lib/ohai/plugins/openstack.rb