lib/ohai/plugins/ec2.rb in ohai-17.9.4 vs lib/ohai/plugins/ec2.rb in ohai-18.0.14
- old
+ new
@@ -79,11 +79,11 @@
# 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
# linux hosts
# @return [Boolean] do we have a Xen Identifying Number or not?
def has_ec2_identifying_number?
- if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
+ if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
wmi = WmiLite::Wmi.new
if /^ec2/.match?(wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"])
logger.trace("Plugin EC2: has_ec2_identifying_number? == true")
true
@@ -140,11 +140,11 @@
end
ec2[:userdata] = fetch_userdata
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"
+
+ if ec2[:userdata] && ec2[:userdata].encoding == Encoding::BINARY
logger.trace("Plugin EC2: Binary UserData Found. Storing in base64")
ec2[:userdata] = Base64.encode64(ec2[:userdata])
end
else
logger.trace("Plugin EC2: looks_like_ec2? == false")