Module: Wakame::VmManipulator::EC2::MetadataService
- Included in:
- Wakame::VmManipulator::EC2
- Defined in:
- lib/wakame/vm_manipulator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.fetch_local_attrs ⇒ Object
169 170 171 172 173 174 175 176 |
# File 'lib/wakame/vm_manipulator.rb', line 169 def fetch_local_attrs attrs = {} %w[instance-id instance-type local-ipv4 local-hostname public-hostname public-ipv4 ami-id].each { |key| rkey = key.tr('-', '_') attrs[rkey.to_sym]=(key) } attrs end |
.query_metadata_uri(key) ⇒ Object
160 161 162 163 164 165 |
# File 'lib/wakame/vm_manipulator.rb', line 160 def (key) require 'open-uri' open("http://169.254.169.254/2008-02-01/meta-data/#{key}") { |f| return f.readline } end |
Instance Method Details
#fetch_local_attrs ⇒ Object
169 170 171 172 173 174 175 176 |
# File 'lib/wakame/vm_manipulator.rb', line 169 def fetch_local_attrs attrs = {} %w[instance-id instance-type local-ipv4 local-hostname public-hostname public-ipv4 ami-id].each { |key| rkey = key.tr('-', '_') attrs[rkey.to_sym]=(key) } attrs end |
#query_metadata_uri(key) ⇒ Object
160 161 162 163 164 165 |
# File 'lib/wakame/vm_manipulator.rb', line 160 def (key) require 'open-uri' open("http://169.254.169.254/2008-02-01/meta-data/#{key}") { |f| return f.readline } end |