ec2.rb

Path: lib/ohai/plugins/ec2.rb
Last Update: Thu Jan 17 19:03:16 +0000 2013
dot/f_0.png
Author:Tim Dysinger (<tim@dysinger.net>)
Author:Benjamin Black (<bb@opscode.com>)
Author:Christopher Brown (<cb@opscode.com>)
Copyright:Copyright (c) 2009 Opscode, Inc.
License:Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Required files

ohai/mixin/ec2_metadata  

Methods

Public Instance methods

[Source]

    # File lib/ohai/plugins/ec2.rb, line 30
30: def has_ec2_mac?
31:   network[:interfaces].values.each do |iface|
32:     unless iface[:arp].nil?
33:       if iface[:arp].value?("fe:ff:ff:ff:ff:ff")
34:         Ohai::Log.debug("has_ec2_mac? == true")
35:         return true
36:       end
37:     end
38:   end
39:   Ohai::Log.debug("has_ec2_mac? == false")
40:   false
41: end

[Source]

    # File lib/ohai/plugins/ec2.rb, line 43
43: def looks_like_ec2?
44:   # Try non-blocking connect so we don't "block" if 
45:   # the Xen environment is *not* EC2
46:   hint?('ec2') || has_ec2_mac? && can_metadata_connect?(EC2_METADATA_ADDR,80)
47: end

[Validate]