lib/ohai/plugins/ec2.rb in ohai-8.15.1 vs lib/ohai/plugins/ec2.rb in ohai-8.16.0

- old
+ new

@@ -39,46 +39,46 @@ # this gets us detection of HVM instances that are within a VPC def has_ec2_dmi? begin # detect a version of '4.2.amazon' if dmi[:bios][:all_records][0][:Version] =~ /amazon/ - Ohai::Log.debug("ec2 plugin: has_ec2_dmi? == true") + Ohai::Log.debug("Plugin EC2: has_ec2_dmi? == true") return true end rescue NoMethodError # dmi[:bios][:all_records][0][:Version] may not exist end - Ohai::Log.debug("ec2 plugin: has_ec2_dmi? == false") + Ohai::Log.debug("Plugin EC2: has_ec2_dmi? == false") return false end # looks for a xen UUID that starts with ec2 # this gets us detection of Linux HVM and Paravirt hosts def has_ec2_xen_uuid? if ::File.exist?("/sys/hypervisor/uuid") if ::File.read("/sys/hypervisor/uuid") =~ /^ec2/ - Ohai::Log.debug("ec2 plugin: has_ec2_xen_uuid? == true") + Ohai::Log.debug("Plugin EC2: has_ec2_xen_uuid? == true") return true end end - Ohai::Log.debug("ec2 plugin: has_ec2_xen_uuid? == false") + Ohai::Log.debug("Plugin EC2: has_ec2_xen_uuid? == false") return false end # looks for the Amazon.com Organization in Windows Kernel data # this gets us detection of Windows systems def has_amazon_org? begin # detect an Organization of 'Amazon.com' if kernel[:os_info][:organization] =~ /Amazon/ - Ohai::Log.debug("ec2 plugin: has_amazon_org? == true") + Ohai::Log.debug("Plugin EC2: has_amazon_org? == true") return true end rescue NoMethodError # kernel[:os_info][:organization] may not exist end - Ohai::Log.debug("ec2 plugin: has_amazon_org? == false") + Ohai::Log.debug("Plugin EC2: has_amazon_org? == false") return false end def looks_like_ec2? return true if hint?("ec2") @@ -89,11 +89,11 @@ end end collect_data do if looks_like_ec2? - Ohai::Log.debug("ec2 plugin: looks_like_ec2? == true") + Ohai::Log.debug("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. @@ -102,14 +102,14 @@ ec2[k] = v end ec2[:userdata] = fetch_userdata # ASCII-8BIT is equivalent to BINARY in this case if ec2[:userdata] && ec2[:userdata].encoding.to_s == "ASCII-8BIT" - Ohai::Log.debug("ec2 plugin: Binary UserData Found. Storing in base64") + Ohai::Log.debug("Plugin EC2: Binary UserData Found. Storing in base64") ec2[:userdata] = Base64.encode64(ec2[:userdata]) end else - Ohai::Log.debug("ec2 plugin: looks_like_ec2? == false") + Ohai::Log.debug("Plugin EC2: looks_like_ec2? == false") false end end end