From 53303c0e4e7fcb2eb939c408d51fbfec11f50a12 Mon Sep 17 00:00:00 2001 From: Jard Leex Date: Tue, 20 Feb 2024 09:10:13 +0100 Subject: [PATCH] fixing rubocop errors --- lib/puppet/provider/consul_acl/default.rb | 6 +++--- lib/puppet/provider/consul_key_value/default.rb | 4 ++-- lib/puppet/provider/consul_prepared_query/default.rb | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/puppet/provider/consul_acl/default.rb b/lib/puppet/provider/consul_acl/default.rb index f91ecbd3..82a1f3c5 100644 --- a/lib/puppet/provider/consul_acl/default.rb +++ b/lib/puppet/provider/consul_acl/default.rb @@ -41,8 +41,8 @@ def self.list_resources(acl_api_token, port, hostname, protocol, tries) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.instance_of? URI::HTTPS - path = uri.request_uri + "/list" - http_headers = { 'X-Consul-Token' => "#{acl_api_token}" } + path = "#{uri.request_uri}/list" + http_headers = { 'X-Consul-Token' => acl_api_token.to_s } req = Net::HTTP::Get.new(path, http_headers) res = nil res_code = nil @@ -96,7 +96,7 @@ def put_acl(method, body) http.use_ssl = true if uri.instance_of? URI::HTTPS acl_api_token = @resource[:acl_api_token] path = uri.request_uri + "/#{method}" - http_headers = { 'X-Consul-Token' => "#{acl_api_token}" } + http_headers = { 'X-Consul-Token' => acl_api_token.to_s } req = Net::HTTP::Put.new(path, http_headers) req.body = body.to_json if body res = http.request(req) diff --git a/lib/puppet/provider/consul_key_value/default.rb b/lib/puppet/provider/consul_key_value/default.rb index 10f14771..c30548b9 100644 --- a/lib/puppet/provider/consul_key_value/default.rb +++ b/lib/puppet/provider/consul_key_value/default.rb @@ -43,7 +43,7 @@ def self.list_resources(acl_api_token, port, hostname, protocol, tries, datacent uri = URI(consul_url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.instance_of? URI::HTTPS - http_headers = { 'X-Consul-Token' => "#{acl_api_token}" } + http_headers = { 'X-Consul-Token' => acl_api_token.to_s } req = Net::HTTP::Get.new(uri.request_uri, http_headers) res = nil @@ -91,7 +91,7 @@ def get_path(name) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.instance_of? URI::HTTPS acl_api_token = @resource[:acl_api_token] - http_headers = { 'X-Consul-Token' => "#{acl_api_token}" } + http_headers = { 'X-Consul-Token' => acl_api_token.to_s } [uri.request_uri, http, http_headers] end diff --git a/lib/puppet/provider/consul_prepared_query/default.rb b/lib/puppet/provider/consul_prepared_query/default.rb index e29b828e..07637075 100644 --- a/lib/puppet/provider/consul_prepared_query/default.rb +++ b/lib/puppet/provider/consul_prepared_query/default.rb @@ -38,7 +38,7 @@ def self.list_resources(acl_api_token, port, hostname, protocol, tries) uri = URI("#{protocol}://#{hostname}:#{port}/v1/query") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.instance_of? URI::HTTPS - http_headers = { 'X-Consul-Token' => "#{acl_api_token}" } + http_headers = { 'X-Consul-Token' => acl_api_token.to_s } req = Net::HTTP::Get.new(uri.request_uri, http_headers) res = nil @@ -81,7 +81,7 @@ def get_path(id) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.instance_of? URI::HTTPS acl_api_token = @resource[:acl_api_token] - http_headers = { 'X-Consul-Token' => "#{acl_api_token}" } + http_headers = { 'X-Consul-Token' => acl_api_token.to_s } [uri.request_uri, http, http_headers] end