diff options
author | Jean byroot Boussier <jean.boussier+github@shopify.com> | 2022-02-17 15:28:08 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2022-02-22 21:42:52 +0100 |
commit | 77929155a6f82b7e65db624b37766bf9fb5f81fb (patch) | |
tree | 97942fc8589fd378693c1075f5610fa724ab82e2 | |
parent | dbcf8aa71b7e82b93597c48b5e06f0a001ff5048 (diff) | |
download | ohai-77929155a6f82b7e65db624b37766bf9fb5f81fb.tar.gz |
Stop checking encoding names
Comparing the names is much less efficient than comparing the instance directly.
It may also change in the future: https://bugs.ruby-lang.org/issues/18576
Signed-off-by: Jean Boussier <jean.boussier@gmail.com>
-rw-r--r-- | lib/ohai/plugins/ec2.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ohai/plugins/ec2.rb b/lib/ohai/plugins/ec2.rb index eb9fa480..79c124fe 100644 --- a/lib/ohai/plugins/ec2.rb +++ b/lib/ohai/plugins/ec2.rb @@ -142,8 +142,8 @@ Ohai.plugin(:EC2) do 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 |