summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-06-14 18:31:16 -0700
committerTim Smith <tsmith84@gmail.com>2020-06-14 18:31:16 -0700
commit438ce464ad85b60761f9f3e1c43262c34fcb1f3b (patch)
tree69d757ebe421e0440403dae1161c6408fa6c5e02 /lib/chef/provider
parent70765481213c0fb1ff7fca7a379e0faca4e0ee96 (diff)
downloadchef-438ce464ad85b60761f9f3e1c43262c34fcb1f3b.tar.gz
Chefstyle fixes
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/provider')
-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