Ah. Well, that’s good to know. Thanks Doug!
–
Jeff Byrnes
@thejeffbyrnes
Lead DevOps Engineer
EverTrue
704.516.4628
On January 30, 2015 at 2:24:07 PM, Douglas Garstang (doug.garstang@gmail.com) wrote:
Jeff,
No, but I’ve realised I can’t use it anyway. Apparently data from custom ohai plugins is not available in the attributes.rb file. However, data from standard ohai plugins is. I don’t think this is documented anywhere. I worked this out from observation. Since, at least in my case, I need to check if it’s a vpc or not in the attributes file in order to set attributes used by upstream cookbooks, well, I just can’t use it.
Doug.
On Fri, Jan 30, 2015 at 11:21 AM, Jeff Byrnes jeff@evertrue.com wrote:
Doug,
Do you have this code published anywhere? Would love to help out with it if I can, but can’t tackle it just yet.
–
Jeff Byrnes
@thejeffbyrnes
Lead DevOps Engineer
EverTrue
704.516.4628
On January 29, 2015 at 4:10:11 PM, Douglas Garstang (doug.garstang@gmail.com) wrote:
I was trying to write an ohai plugin to add an attribute that tells me if I’m in a VPC or not. Not really sure what I’m doing. This code works on a real VPC instance, but on vagrant it’s not even setting is_vpc. 
require ‘json’
Ohai.plugin(:EC2VPC) do
provides “is_vpc”
collect_data do
isa_vpc = false
if ec2.is_a?(Hash)
if ec2.has_key?(‘network_interfaces_macs’)
ec2[‘network_interfaces_macs’].each_pair do |iface, data|
if data.key?(‘vpc_id’)
isa_vpc = true
end
end
end
end
is_vpc isa_vpc
end
end
Doug.
–
Regards,
Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627