lib/ohai/plugins/ec2.rb in ohai-13.12.6 vs lib/ohai/plugins/ec2.rb in ohai-14.0.28

- old
+ new

@@ -40,14 +40,14 @@ # this gets us detection of new Xen-less HVM instances that are within a VPC # @return [Boolean] do we have Amazon DMI data? def has_ec2_amazon_dmi? # detect a version of '4.2.amazon' if file_val_if_exists("/sys/class/dmi/id/bios_vendor") =~ /Amazon/ - Ohai::Log.debug("Plugin EC2: has_ec2_amazon_dmi? == true") + logger.trace("Plugin EC2: has_ec2_amazon_dmi? == true") true else - Ohai::Log.debug("Plugin EC2: has_ec2_amazon_dmi? == false") + logger.trace("Plugin EC2: has_ec2_amazon_dmi? == false") false end end # look for amazon string in dmi bios version data within the sys tree. @@ -55,26 +55,26 @@ # this gets us detection of HVM instances that are within a VPC # @return [Boolean] do we have Amazon DMI data? def has_ec2_xen_dmi? # detect a version of '4.2.amazon' if file_val_if_exists("/sys/class/dmi/id/bios_version") =~ /amazon/ - Ohai::Log.debug("Plugin EC2: has_ec2_xen_dmi? == true") + logger.trace("Plugin EC2: has_ec2_xen_dmi? == true") true else - Ohai::Log.debug("Plugin EC2: has_ec2_xen_dmi? == false") + logger.trace("Plugin EC2: has_ec2_xen_dmi? == false") false end end # looks for a xen UUID that starts with ec2 from within the Linux sys tree # @return [Boolean] do we have a Xen UUID or not? def has_ec2_xen_uuid? if file_val_if_exists("/sys/hypervisor/uuid") =~ /^ec2/ - Ohai::Log.debug("Plugin EC2: has_ec2_xen_uuid? == true") + logger.trace("Plugin EC2: has_ec2_xen_uuid? == true") return true end - Ohai::Log.debug("Plugin EC2: has_ec2_xen_uuid? == false") + logger.trace("Plugin EC2: has_ec2_xen_uuid? == false") false end # looks at the identifying number WMI value to see if it starts with ec2. # this is actually the same value we're looking at in has_ec2_xen_uuid? on @@ -83,15 +83,15 @@ def has_ec2_identifying_number? if RUBY_PLATFORM =~ /mswin|mingw32|windows/ require "wmi-lite/wmi" wmi = WmiLite::Wmi.new if wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"] =~ /^ec2/ - Ohai::Log.debug("Plugin EC2: has_ec2_identifying_number? == true") + logger.trace("Plugin EC2: has_ec2_identifying_number? == true") return true end else - Ohai::Log.debug("Plugin EC2: has_ec2_identifying_number? == false") + logger.trace("Plugin EC2: has_ec2_identifying_number? == false") false end end # return the contents of a file if the file exists @@ -114,11 +114,11 @@ end end collect_data do if looks_like_ec2? - Ohai::Log.debug("Plugin EC2: looks_like_ec2? == true") + logger.trace("Plugin EC2: looks_like_ec2? == true") ec2 Mash.new fetch_metadata.each do |k, v| # fetch_metadata returns IAM security credentials, including the IAM user's # secret access key. We'd rather not have ohai send this information # to the server. @@ -130,14 +130,14 @@ ec2[:account_id] = fetch_dynamic_data["accountId"] ec2[:availability_zone] = fetch_dynamic_data["availabilityZone"] ec2[:region] = fetch_dynamic_data["region"] # ASCII-8BIT is equivalent to BINARY in this case if ec2[:userdata] && ec2[:userdata].encoding.to_s == "ASCII-8BIT" - Ohai::Log.debug("Plugin EC2: Binary UserData Found. Storing in base64") + logger.trace("Plugin EC2: Binary UserData Found. Storing in base64") ec2[:userdata] = Base64.encode64(ec2[:userdata]) end else - Ohai::Log.debug("Plugin EC2: looks_like_ec2? == false") + logger.trace("Plugin EC2: looks_like_ec2? == false") false end end end