Hi,
I am using Ohai 0.6.4.
I don’t seem to be able to get Ohai to return EC2 data consistently.
When I run this ruby script by passing it in via the AMI userdata:
require 'ohai’
o = Ohai::System.new
o.all_plugins
o.require_plugin(‘ec2’)
$stderr.puts o.fetch_metadata
$stderr.puts o.looks_like_ec2?
$stderr.puts o[:ec2].inspect
I get the results:
<ec2/ami-data-hash>
false
nil
So, the metadata is retrieved, but the second two EC2 methods don’t
seem to work.
More puzzling is that if I SSH to the instance, and run this same
script, the o[:ec2] contains the data I’d expect.
So how does one use Ohai, correctly, in an EC2 user data script?
Appreciate any insights.
–
πόλλ’ οἶδ ἀλώπηξ, ἀλλ’ ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com
It's broken, gem install ohai --pre
–AJ
On 28 September 2011 16:15, Hedge Hog hedgehogshiatus@gmail.com wrote:
Hi,
I am using Ohai 0.6.4.
I don't seem to be able to get Ohai to return EC2 data consistently.
When I run this ruby script by passing it in via the AMI userdata:
require 'ohai'
o = Ohai::System.new
o.all_plugins
o.require_plugin('ec2')
$stderr.puts o.fetch_metadata
$stderr.puts o.looks_like_ec2?
$stderr.puts o[:ec2].inspect
I get the results:
<ec2/ami-data-hash>
false
nil
So, the metadata is retrieved, but the second two EC2 methods don't
seem to work.
More puzzling is that if I SSH to the instance, and run this same
script, the o[:ec2] contains the data I'd expect.
So how does one use Ohai, correctly, in an EC2 user data script?
Appreciate any insights.
--
πόλλ' οἶδ ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com
..run with -l debug to see the StringIO exception being bubbled up
from popen or whatever the fuck it was, already fixed in the RC.
–AJ
On 28 September 2011 16:18, AJ Christensen aj@junglist.gen.nz wrote:
It's broken, gem install ohai --pre
–AJ
On 28 September 2011 16:15, Hedge Hog hedgehogshiatus@gmail.com wrote:
Hi,
I am using Ohai 0.6.4.
I don't seem to be able to get Ohai to return EC2 data consistently.
When I run this ruby script by passing it in via the AMI userdata:
require 'ohai'
o = Ohai::System.new
o.all_plugins
o.require_plugin('ec2')
$stderr.puts o.fetch_metadata
$stderr.puts o.looks_like_ec2?
$stderr.puts o[:ec2].inspect
I get the results:
<ec2/ami-data-hash>
false
nil
So, the metadata is retrieved, but the second two EC2 methods don't
seem to work.
More puzzling is that if I SSH to the instance, and run this same
script, the o[:ec2] contains the data I'd expect.
So how does one use Ohai, correctly, in an EC2 user data script?
Appreciate any insights.
--
πόλλ' οἶδ ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com
On Wed, Sep 28, 2011 at 1:18 PM, AJ Christensen aj@junglist.gen.nz wrote:
It's broken, gem install ohai --pre
Okay, thanks
–AJ
On 28 September 2011 16:15, Hedge Hog hedgehogshiatus@gmail.com wrote:
Hi,
I am using Ohai 0.6.4.
I don't seem to be able to get Ohai to return EC2 data consistently.
When I run this ruby script by passing it in via the AMI userdata:
require 'ohai'
o = Ohai::System.new
o.all_plugins
o.require_plugin('ec2')
$stderr.puts o.fetch_metadata
$stderr.puts o.looks_like_ec2?
$stderr.puts o[:ec2].inspect
I get the results:
<ec2/ami-data-hash>
false
nil
So, the metadata is retrieved, but the second two EC2 methods don't
seem to work.
More puzzling is that if I SSH to the instance, and run this same
script, the o[:ec2] contains the data I'd expect.
So how does one use Ohai, correctly, in an EC2 user data script?
Appreciate any insights.
--
πόλλ' οἶδ ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com
--
πόλλ' οἶδ ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com