summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2020-05-07 14:16:59 +0530
committerTim Smith <tsmith84@gmail.com>2020-08-17 21:42:51 -0700
commit8ca992faa0ecd47dd02ad1f6578afec5ff3e0bc8 (patch)
tree1961f1a5385a4787551002035687df8c9b542e91
parentc05b0814ce6c12a978903f546e52d949c459cd5f (diff)
downloadchef-8ca992faa0ecd47dd02ad1f6578afec5ff3e0bc8.tar.gz
Fix install features when install state is removed
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
-rw-r--r--lib/chef/resource/windows_feature_powershell.rb4
-rw-r--r--spec/unit/resource/windows_feature_powershell_spec.rb4
2 files changed, 2 insertions, 6 deletions
diff --git a/lib/chef/resource/windows_feature_powershell.rb b/lib/chef/resource/windows_feature_powershell.rb
index 6e4e0e5ff5..5ec89835c8 100644
--- a/lib/chef/resource/windows_feature_powershell.rb
+++ b/lib/chef/resource/windows_feature_powershell.rb
@@ -163,8 +163,8 @@ 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 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
+ @install ||= new_resource.feature_name & ( node["powershell_features_cache"]["disabled"] | node["powershell_features_cache"]["removed"] )
end
# @return [Array] features the user has requested to remove which need removing
diff --git a/spec/unit/resource/windows_feature_powershell_spec.rb b/spec/unit/resource/windows_feature_powershell_spec.rb
index b727d8dfb5..d435a20765 100644
--- a/spec/unit/resource/windows_feature_powershell_spec.rb
+++ b/spec/unit/resource/windows_feature_powershell_spec.rb
@@ -36,10 +36,6 @@ describe Chef::Resource::WindowsFeaturePowershell do
expect(resource.feature_name).to eql(%w{snmp dhcp})
end
- it "sets the default action as :install" do
- expect(resource.action).to eql([:install])
- end
-
it "supports :delete, :install, :remove actions" do
expect { resource.action :delete }.not_to raise_error
expect { resource.action :install }.not_to raise_error