summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-07-31 10:36:41 -0700
committerGitHub <noreply@github.com>2020-07-31 10:36:41 -0700
commit6d6ae2c5bd2f243a1405c1e829dcc329336be90e (patch)
tree83330b023cbb32549e403bcbb727cf8935aec190 /lib/chef
parenta0675c3219636a442c3d303cebfcd9e28ea2ebd9 (diff)
parent183b65ae8b77ee8189b2aa147ca651620c4c8297 (diff)
downloadchef-6d6ae2c5bd2f243a1405c1e829dcc329336be90e.tar.gz
Merge pull request #9820 from MsysTechnologiesllc/dh/fix_feature_install_when_state_is_removed
Fix install windows features when install state is removed
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/resource/windows_feature_powershell.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/resource/windows_feature_powershell.rb b/lib/chef/resource/windows_feature_powershell.rb
index d165dca959..c9d9abcd6f 100644
--- a/lib/chef/resource/windows_feature_powershell.rb
+++ b/lib/chef/resource/windows_feature_powershell.rb
@@ -141,8 +141,12 @@ class Chef
action_class do
# @return [Array] features the user has requested to install which need installation
def features_to_install
- # the intersection of the features to install & disabled features are what needs installing
- @install ||= new_resource.feature_name & node["powershell_features_cache"]["disabled"]
+ # the intersection of the features to install & disabled/removed features are what needs installing
+ @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
# @return [Array] features the user has requested to remove which need removing