summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-06-23 10:54:40 -0700
committerTim Smith <tsmith84@gmail.com>2020-06-23 10:54:40 -0700
commit27d65bc2111c26a1f38d839b3b5aad797259dfa0 (patch)
tree3fccbb92d0497af74b12ea247422eb7f9b7a29d1
parent4dbc101801bc6f12c4d6c71a0f607c672c1516fb (diff)
downloadchef-27d65bc2111c26a1f38d839b3b5aad797259dfa0.tar.gz
Chefstyle fixes
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/provider/package/snap.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/chef/provider/package/snap.rb b/lib/chef/provider/package/snap.rb
index 7fdedd0078..7aaaf3f30f 100644
--- a/lib/chef/provider/package/snap.rb
+++ b/lib/chef/provider/package/snap.rb
@@ -140,7 +140,7 @@ class Chef
# socket is /run/snapd.socket note - unixsocket is not defined on
# windows systems
if defined?(::UNIXSocket)
- UNIXSocket.open('/run/snapd.socket') do |socket|
+ UNIXSocket.open("/run/snapd.socket") do |socket|
# send request, read the response, split the response and parse
# the body
socket.write(request)
@@ -169,7 +169,7 @@ class Chef
# - jaymzh
Chef::Log.trace(
- "snap_package[#{new_resource.package_name}]: reading headers",
+ "snap_package[#{new_resource.package_name}]: reading headers"
)
loop do
response = socket.readline
@@ -177,15 +177,16 @@ class Chef
end
Chef::Log.trace(
"snap_package[#{new_resource.package_name}]: past headers, " +
- 'onto the body...',
+ "onto the body..."
)
result = nil
- body = ''
+ body = ""
socket.each_char do |c|
body << c
# we know we're not done if we don't have a char that
# can end JSON
- next unless ['}', ']'].include?(c)
+ next unless ["}", "]"].include?(c)
+
begin
result = JSON.parse(body)
# if we get here, we were able to parse the json so we