Please review pull request #138: Fixed #11666 - Add is_ec2 and is_euca facts opened by (jamtur01)
Description:
Sometimes you just want to know if a host is EC2 or Eucalyptus. This
adds two facts in a similar vein to the "is_virtual" fact.
The is_ec2 fact is set to true if an EC2 ARP entry is present and the
is_euca fact to true if there is a Eucalyptus MAC address.
Otherwise both default to false.
- Opened: Tue Jan 03 01:52:54 UTC 2012
- Based on: puppetlabs:master (bc95f0b0bf2e970500042d16cffe0d94860fde51)
- Requested merge: jamtur01:tickets/master/11666 (99c8b97a099cd4c95c34f13deca3d08f250e3183)
Diff follows:
diff --git a/lib/facter/ec2.rb b/lib/facter/ec2.rb index 173daea..e7c7989 100644 --- a/lib/facter/ec2.rb +++ b/lib/facter/ec2.rb @@ -59,9 +59,18 @@ def has_ec2_arp? is_amazon_arp end +if has_ec2_arp? + Facter.add(:is_ec2) { setcode { "true" } } +elsif has_euca_mac? + Facter.add(:is_euca) { setcode { "true" } } +else + Facter.add(:is_ec2) { setcode { "false" } } + Facter.add(:is_euca) { setcode { "false" } } +end + if (has_euca_mac? || has_ec2_arp?) && can_connect? metadata userdata else - Facter.debug "Not an EC2 host" + Facter.debug "Not an EC2 or Eucalyptus host" end
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.