[chef] Re: Re: Ohai timeouts inside VPC

Chronological Thread 
  • From: Douglas Garstang < >
  • To:
  • Subject: [chef] Re: Re: Ohai timeouts inside VPC
  • Date: Fri, 30 Jan 2015 11:30:30 -0800

This is what I've ended up with in attributes/default.rb. Not very pretty but seems to work.

vpc_id = nil
node['ec2']['network_interfaces_macs'].each_pair do |iface, data|
  vpc_id = data['vpc_id'] if data.key?('vpc_id')

case vpc_id
  when nil
    default['openldap']['server'] = node['slice-ldap']['ldap_server_url']
    default['openldap']['server'] = node['slice-ldap']['ldap_server_url_vpc']

Is there a better way?


On Fri, Jan 30, 2015 at 11:28 AM, Douglas Garstang < " target="_blank"> > wrote:

I actually wrote a new plugin. Can't use it tho. Looks like the data returned by custom plugins is not available in attributes/default.rb (data in core ohai seems to be though). Since I imagine this is the most likely place you would want to check (I'm using it to check if it's a VPC and set attributes used by an upstream cookbook), then, well, it's kinda pointless. Actually, this would make most ohai plugins pointless. :(


On Fri, Jan 30, 2015 at 11:24 AM, Steven Danna < " target="_blank"> > wrote:

A quick follow up.  I just saw your other thread about writing a VPC
plugin.  It looks like my knowledge about it being difficult to detect
VPC might be out of date?  If so, improvements to the ec2 plugin
itself are also welcome.



On Fri, Jan 30, 2015 at 7:20 PM, Steven Danna < " target="_blank"> > wrote:
> Hi Douglas,
> Unfortunately, reliably detecting VPC nodes is difficult.  If you are
> only seeing slowness without the ohai hint in place, then my guess is
> that it is a result of the fact that we detect being on ec2 by making
> a network call to the metadata API:
> https://github.com/chef/ohai/blob/master/lib/ohai/plugins/ec2.rb#L45
> If you are seeing the reload slowness even with the hint enabled, then
> I would recommend running chef-client with debug logging turned on.
> The timestamps in the log can often help find which plugins are slow
> to load.
>> It looks like someone has created a cookbook as a workaround for a issue with similar symptons. Is this a known issue?
> The difficulty and slowness of detecting EC2 nodes is known and was
> one of the primary motivators for Ohai's hint system.  Currently,
> using an ohai hint when you know you are on EC2 and disabling the
> plugin when you know you are not on EC2 is the best method to avoid
> the speed penalty (and unreliability) of the ec2 detection methods we
> have.
> The ec2 hint can be put on disk by the knife-ec2 plugin at the time of
> provisioning or by the ohai cookbook's ohai_hint LWRP on the first
> chef-client run. (The ohai cookbook is also capable of disabling
> plugins).
> Hope this helps.
> Cheers,
> Steven
> On Fri, Jan 30, 2015 at 5:47 PM, Douglas Garstang
> < " target="_blank"> > wrote:
>> I'm running chef and using ohai plugins inside EC2 instances running in a
>> VPC. Aside from creating the hints file, it seems that any ohai reloads are
>> horribly slow.
>> It looks like someone has created a cookbook as a workaround for a issue
>> with similar symptons. Is this a known issue?
>> https://github.com/marcelom/ohai_ec2_hack
>> Doug



Archive powered by MHonArc 2.6.16.