summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Asuncion <jose.asuncion@gmail.com>2017-09-26 15:31:52 -0700
committerJose Asuncion <jose.asuncion@gmail.com>2017-09-26 15:33:05 -0700
commited65b42bb5bf587495918cbf509a4aea871720ec (patch)
tree9d8f1e0876bd6467ff4bc49d9b7a02774643250c
parentd3cf74513829347db86f451cdd3ecc06bab01072 (diff)
downloadchef-ed65b42bb5bf587495918cbf509a4aea871720ec.tar.gz
fix chefstyle
Signed-off-by: Jose Asuncion <jeunito@gmail.com>
-rw-r--r--lib/chef/server_api.rb24
-rw-r--r--spec/unit/server_api_spec.rb4
2 files changed, 13 insertions, 15 deletions
diff --git a/lib/chef/server_api.rb b/lib/chef/server_api.rb
index 3bf0df4880..292e754c4b 100644
--- a/lib/chef/server_api.rb
+++ b/lib/chef/server_api.rb
@@ -57,20 +57,18 @@ class Chef
alias :post_rest :post
alias :put_rest :put
- def get(path, headers={})
- begin
- request(:GET, path, headers)
- rescue Net::HTTPServerException => e
- if e.response.kind_of?(Net::HTTPNotFound)
- begin
- FFI_Yajl::Parser.parse(e.response.body)
- rescue FFI_Yajl::ParseError => e
- raise Chef::Exceptions::NotAChefServerException
- end
- raise
- else
- raise
+ def get(path, headers = {})
+ request(:GET, path, headers)
+ rescue Net::HTTPServerException => e
+ if e.response.kind_of?(Net::HTTPNotFound)
+ begin
+ FFI_Yajl::Parser.parse(e.response.body)
+ rescue FFI_Yajl::ParseError => e
+ raise Chef::Exceptions::NotAChefServerException
end
+ raise
+ else
+ raise
end
end
diff --git a/spec/unit/server_api_spec.rb b/spec/unit/server_api_spec.rb
index 00a6d81d81..c64f42d358 100644
--- a/spec/unit/server_api_spec.rb
+++ b/spec/unit/server_api_spec.rb
@@ -69,7 +69,7 @@ describe Chef::ServerAPI do
api = described_class.new(url, raw_key: SIGNING_KEY_DOT_PEM)
allow(api).to receive(:request).and_raise(Net::HTTPServerException.new("", net_http_not_found))
- expect{ api.get("/nodes") }.to raise_error(Chef::Exceptions::NotAChefServerException)
+ expect { api.get("/nodes") }.to raise_error(Chef::Exceptions::NotAChefServerException)
end
end
@@ -82,7 +82,7 @@ describe Chef::ServerAPI do
api = described_class.new(url, raw_key: SIGNING_KEY_DOT_PEM)
allow(api).to receive(:request).and_raise(Net::HTTPServerException.new("", net_http_not_found))
- expect{ api.get("/nodes") }.to raise_error(Net::HTTPServerException)
+ expect { api.get("/nodes") }.to raise_error(Net::HTTPServerException)
end
end
end