- From: Jeff Byrnes <
>
- To:
- Subject: [chef] Re: Ohai Custom plugin for VPC.
- Date: Fri, 30 Jan 2015 14:21:27 -0500
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.
On January 29, 2015 at 4:10:11 PM, Douglas Garstang (
">
) 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.
|
Archive powered by MHonArc 2.6.16.