Sha256: 79a3c190d207c89686a3c58cc16cfb12db00ff389f998337d0cca6b7611df152
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
# # Author:: Tim Dysinger (<tim@dysinger.net>) # Author:: Benjamin Black (<bb@opscode.com>) # Copyright:: Copyright (c) 2009 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. require 'open-uri' require_plugin "hostname" require_plugin "kernel" def metadata(id='') OpenURI.open_uri("http://169.254.169.254/2008-02-01/meta-data/#{id}"). read.split("\n").each do |o| key = "#{id}#{o.gsub(/\=.*$/, '/')}" if key[-1..-1] != '/' ec2[key.gsub(/\-|\//, '_').to_sym] = OpenURI.open_uri("http://169.254.169.254/2008-02-01" + "/meta-data/#{key}").gets else metadata(key) end end end if (domain =~ /\.internal$/ || kernel[:release] =~ /-ec2-/) ec2 Mash.new self.metadata end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opscode-ohai-0.1.2 | lib/ohai/plugins/ec2.rb |