summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2020-07-30 07:42:23 +0530
committerdheerajd-msys <dheeraj.dubey@msystechnologies.com>2020-07-30 07:42:23 +0530
commit6352538c3aefc1b3fe2ec072f787192e1c87862b (patch)
treebd7d4520805d4b8215571903e0a2146f3ae77180
parenta9b059341703147c904f38abe65a867d5716bf56 (diff)
downloadchef-6352538c3aefc1b3fe2ec072f787192e1c87862b.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 048c67229c..a0bb82e868 100644
--- a/lib/chef/resource/windows_feature_powershell.rb
+++ b/lib/chef/resource/windows_feature_powershell.rb
@@ -142,10 +142,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