summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2020-07-30 07:42:23 +0530
committerTim Smith <tsmith84@gmail.com>2020-08-17 21:42:58 -0700
commit9d002e91ceb49121fddea1e1061013903e9f0184 (patch)
tree32e09f2f62021aa1adfe14317417c5e4e6c5ef1e
parent473b4f93954260f5b532bfc5c3ea65363818d96b (diff)
downloadchef-9d002e91ceb49121fddea1e1061013903e9f0184.tar.gz
optimized code
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
-rw-r--r--lib/chef/resource/windows_feature_powershell.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/resource/windows_feature_powershell.rb b/lib/chef/resource/windows_feature_powershell.rb
index f97c71c2a7..0fcd52241a 100644
--- a/lib/chef/resource/windows_feature_powershell.rb
+++ b/lib/chef/resource/windows_feature_powershell.rb
@@ -164,10 +164,10 @@ class Chef
# @return [Array] features the user has requested to install which need installation
def features_to_install
# the intersection of the features to install & disabled/removed features are what needs installing
- if new_resource.source && node["powershell_features_cache"]["removed"]
- @install ||= new_resource.feature_name & ( node["powershell_features_cache"]["disabled"] | node["powershell_features_cache"]["removed"] )
- else
- @install ||= new_resource.feature_name & node["powershell_features_cache"]["disabled"]
+ @features_to_install ||= begin
+ features = node["powershell_features_cache"]["disabled"]
+ features |= node["powershell_features_cache"]["removed"] if new_resource.source
+ new_resource.feature_name & features
end
end