- From: Hedge Hog <
>
- To:
- Subject: [chef] Re: Re: How to use Ohai in a EC2 userdata script?
- Date: Wed, 28 Sep 2011 13:39:03 +1000
On Wed, Sep 28, 2011 at 1:18 PM, AJ Christensen
<
>
wrote:
>
It's broken, gem install ohai --pre
>
Okay, thanks
>
–AJ
>
>
On 28 September 2011 16:15, Hedge Hog
>
<
>
>
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
Archive powered by MHonArc 2.6.16.