summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilkosz <joshua@wilkosz.com.au>2020-04-27 15:27:03 +1000
committerwilkosz <joshua@wilkosz.com.au>2020-04-27 15:27:03 +1000
commitf4d8c30c35e9f285f966d4e7d72fda7fc72085d6 (patch)
tree0f35f445e64416e555c621777785152c727f3060
parent8699b6d1e8d9c3fdb859fbe8083fd4291ff8816d (diff)
downloadohai-f4d8c30c35e9f285f966d4e7d72fda7fc72085d6.tar.gz
run lint correction on files
-rw-r--r--lib/ohai/mixin/ec2_metadata.rb11
-rw-r--r--spec/unit/plugins/ec2_spec.rb2
-rw-r--r--spec/unit/plugins/eucalyptus_spec.rb2
-rw-r--r--spec/unit/plugins/openstack_spec.rb2
4 files changed, 9 insertions, 8 deletions
diff --git a/lib/ohai/mixin/ec2_metadata.rb b/lib/ohai/mixin/ec2_metadata.rb
index 9e5f15c1..4de7ed74 100644
--- a/lib/ohai/mixin/ec2_metadata.rb
+++ b/lib/ohai/mixin/ec2_metadata.rb
@@ -50,7 +50,7 @@ module Ohai
def best_api_version
@api_version ||= begin
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}/ to determine the latest supported metadata release")
- response = http_client.get("/", {:'X-aws-ec2-metadata-token' => v2_token})
+ response = http_client.get("/", { 'X-aws-ec2-metadata-token': v2_token })
if response.code == "404"
logger.trace("Mixin EC2: Received HTTP 404 from metadata server while determining API version, assuming 'latest'")
return "latest"
@@ -84,8 +84,9 @@ module Ohai
end
def v2_token
- http_client.put('/latest/api/token/', nil, {:'X-aws-ec2-metadata-token-ttl-seconds' => '60'})&.body
+ http_client.put("/latest/api/token/", nil, { 'X-aws-ec2-metadata-token-ttl-seconds': "60" })&.body
end
+
# Get metadata for a given path and API version
#
# Typically, a 200 response is expected for valid metadata.
@@ -95,7 +96,7 @@ module Ohai
def metadata_get(id, api_version)
path = "/#{api_version}/meta-data/#{id}"
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}#{path}")
- response = http_client.get(path, {:'X-aws-ec2-metadata-token' => v2_token})
+ response = http_client.get(path, { 'X-aws-ec2-metadata-token': v2_token })
case response.code
when "200"
response.body
@@ -176,13 +177,13 @@ module Ohai
def fetch_userdata
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}/#{best_api_version}/user-data/")
- response = http_client.get("/#{best_api_version}/user-data/", {:'X-aws-ec2-metadata-token' => v2_token})
+ response = http_client.get("/#{best_api_version}/user-data/", { 'X-aws-ec2-metadata-token': v2_token })
response.code == "200" ? response.body : nil
end
def fetch_dynamic_data
@fetch_dynamic_data ||= begin
- response = http_client.get("/#{best_api_version}/dynamic/instance-identity/document/", {:'X-aws-ec2-metadata-token' => v2_token})
+ response = http_client.get("/#{best_api_version}/dynamic/instance-identity/document/", { 'X-aws-ec2-metadata-token': v2_token })
if json?(response.body) && response.code == "200"
FFI_Yajl::Parser.parse(response.body)
diff --git a/spec/unit/plugins/ec2_spec.rb b/spec/unit/plugins/ec2_spec.rb
index 5c26f926..d586d94b 100644
--- a/spec/unit/plugins/ec2_spec.rb
+++ b/spec/unit/plugins/ec2_spec.rb
@@ -49,7 +49,7 @@ describe Ohai::System, "plugin ec2" do
allow(t).to receive(:connect_nonblock).and_raise(Errno::EINPROGRESS)
allow(Socket).to receive(:new).and_return(t)
token = "AQAEAE4UUd-3NE5EEeYYXKxicVfDOHsx0YSHFFSuCvo2GfCcxzJsvg=="
- @get_req_token_header = {:'X-aws-ec2-metadata-token' => token}
+ @get_req_token_header = { 'X-aws-ec2-metadata-token': token }
allow(@http_client).to receive(:put) { double("Net::HTTP::PUT Response", body: token, code: "200") }
expect(@http_client).to receive(:get)
.with("/", @get_req_token_header)
diff --git a/spec/unit/plugins/eucalyptus_spec.rb b/spec/unit/plugins/eucalyptus_spec.rb
index d27298a4..2f27d3b3 100644
--- a/spec/unit/plugins/eucalyptus_spec.rb
+++ b/spec/unit/plugins/eucalyptus_spec.rb
@@ -34,7 +34,7 @@ describe Ohai::System, "plugin eucalyptus" do
before do
@http_client = double("Net::HTTP client")
@token = "AQAEAE4UUd-3NE5EEeYYXKxicVfDOHsx0YSHFFSuCvo2GfCcxzJsvg=="
- @get_req_token_header = {:'X-aws-ec2-metadata-token' => @token}
+ @get_req_token_header = { 'X-aws-ec2-metadata-token': @token }
allow(plugin).to receive(:http_client).and_return(@http_client)
allow(@http_client).to receive(:put) { double("Net::HTTP::PUT Response", body: @token, code: "200") }
diff --git a/spec/unit/plugins/openstack_spec.rb b/spec/unit/plugins/openstack_spec.rb
index 8700957f..7964aee1 100644
--- a/spec/unit/plugins/openstack_spec.rb
+++ b/spec/unit/plugins/openstack_spec.rb
@@ -190,7 +190,7 @@ describe Ohai::System, "plugin openstack" do
token = "AQAEAE4UUd-3NE5EEeYYXKxicVfDOHsx0YSHFFSuCvo2GfCcxzJsvg=="
allow(http_client).to receive(:put) { double("Net::HTTP::PUT Response", body: token, code: "200") }
allow(http_client).to receive(:get)
- .with(url, {:'X-aws-ec2-metadata-token' =>token})
+ .with(url, { 'X-aws-ec2-metadata-token': token })
.and_return(double("HTTP Response", code: "200", body: response_body))
end