summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-11-06 12:14:33 -0800
committerGitHub <noreply@github.com>2020-11-06 12:14:33 -0800
commit0b5faccd9f852e7f73a58cbba65475343f7109e2 (patch)
tree14800fe5adacdbfbc66b3fd0a0503e08c8588f41
parentc2d124a79b76c30009c8c1e07b02d78bd350554b (diff)
parente3bbd4e45bc55d63b886e0728abd82ecf92f3b7b (diff)
downloadchef-0b5faccd9f852e7f73a58cbba65475343f7109e2.tar.gz
Merge pull request #10604 from chef/collapse
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/file_access_control/windows.rb5
-rw-r--r--lib/chef/node/attribute_collections.rb8
-rw-r--r--lib/chef/provider/cron.rb8
-rw-r--r--lib/chef/provider/package/snap.rb4
-rw-r--r--lib/chef/resource/plist.rb8
-rw-r--r--lib/chef/util/dsc/lcm_output_parser.rb4
-rw-r--r--lib/chef/util/powershell/cmdlet.rb12
7 files changed, 11 insertions, 38 deletions
diff --git a/lib/chef/file_access_control/windows.rb b/lib/chef/file_access_control/windows.rb
index 9e5f07428c..cc1b96a84d 100644
--- a/lib/chef/file_access_control/windows.rb
+++ b/lib/chef/file_access_control/windows.rb
@@ -255,10 +255,7 @@ class Chef
flags |= CONTAINER_INHERIT_ACE
when :objects_only
flags |= OBJECT_INHERIT_ACE
- when true
- flags |= CONTAINER_INHERIT_ACE
- flags |= OBJECT_INHERIT_ACE
- when nil
+ when true, nil
flags |= CONTAINER_INHERIT_ACE
flags |= OBJECT_INHERIT_ACE
end
diff --git a/lib/chef/node/attribute_collections.rb b/lib/chef/node/attribute_collections.rb
index b8fd507336..a420563165 100644
--- a/lib/chef/node/attribute_collections.rb
+++ b/lib/chef/node/attribute_collections.rb
@@ -73,9 +73,7 @@ class Chef
def convert_value(value)
case value
- when VividMash
- value
- when AttrArray
+ when VividMash, AttrArray
value
when Hash
VividMash.new(value, __root__, __node__, __precedence__)
@@ -159,9 +157,7 @@ class Chef
# attribute tree will have the correct cache invalidation behavior.
def convert_value(value)
case value
- when VividMash
- value
- when AttrArray
+ when VividMash, AttrArray
value
when Hash
VividMash.new(value, __root__, __node__, __precedence__)
diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb
index 622f8f5e63..b7aa6dc3fc 100644
--- a/lib/chef/provider/cron.rb
+++ b/lib/chef/provider/cron.rb
@@ -112,13 +112,7 @@ class Chef
when ENV_PATTERN
crontab << line unless cron_found
next
- when SPECIAL_PATTERN
- if cron_found
- cron_found = false
- crontab << newcron
- next
- end
- when CRON_PATTERN
+ when SPECIAL_PATTERN, CRON_PATTERN
if cron_found
cron_found = false
crontab << newcron
diff --git a/lib/chef/provider/package/snap.rb b/lib/chef/provider/package/snap.rb
index 57ee1ed6c6..81af09e04d 100644
--- a/lib/chef/provider/package/snap.rb
+++ b/lib/chef/provider/package/snap.rb
@@ -221,9 +221,7 @@ class Chef
case result["result"]["status"]
when "Do", "Doing", "Undoing", "Undo"
# Continue
- when "Abort"
- raise result
- when "Hold", "Error"
+ when "Abort", "Hold", "Error"
raise result
when "Done"
waiting = false
diff --git a/lib/chef/resource/plist.rb b/lib/chef/resource/plist.rb
index f4058520a9..a7cb88ef57 100644
--- a/lib/chef/resource/plist.rb
+++ b/lib/chef/resource/plist.rb
@@ -151,9 +151,7 @@ class Chef
value.to_i
when "float"
value.to_f
- when "string"
- value
- when "dictionary"
+ when "string", "dictionary"
value
when nil
""
@@ -168,9 +166,7 @@ class Chef
"array"
when Integer
"integer"
- when FalseClass
- "bool"
- when TrueClass
+ when FalseClass, TrueClass
"bool"
when Hash
"dict"
diff --git a/lib/chef/util/dsc/lcm_output_parser.rb b/lib/chef/util/dsc/lcm_output_parser.rb
index 38c202a4bb..509f680bb4 100644
--- a/lib/chef/util/dsc/lcm_output_parser.rb
+++ b/lib/chef/util/dsc/lcm_output_parser.rb
@@ -89,9 +89,7 @@ class Chef
case op_action
when "InDesiredState"
current_resource[:skipped] = op_value.strip == "True" ? true : false
- when "ResourcesInDesiredState"
- current_resource[:name] = op_value.strip if op_value
- when "ResourcesNotInDesiredState"
+ when "ResourcesInDesiredState", "ResourcesNotInDesiredState"
current_resource[:name] = op_value.strip if op_value
when "ReturnValue"
current_resource[:context] = nil
diff --git a/lib/chef/util/powershell/cmdlet.rb b/lib/chef/util/powershell/cmdlet.rb
index ea84798814..1c728fa424 100644
--- a/lib/chef/util/powershell/cmdlet.rb
+++ b/lib/chef/util/powershell/cmdlet.rb
@@ -31,13 +31,9 @@ class Chef
@node = node
case output_format
- when nil
+ when nil, :text
@json_format = false
- when :json
- @json_format = true
- when :text
- @json_format = false
- when :object
+ when :json, :object
@json_format = true
else
raise ArgumentError, "Invalid output format #{output_format} specified"
@@ -128,9 +124,7 @@ class Chef
switch_present = true
case switch_value
- when Numeric
- switch_argument = switch_value.to_s
- when Float
+ when Numeric, Float
switch_argument = switch_value.to_s
when FalseClass
switch_present = false