summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2020-05-07 14:16:59 +0530
committerdheerajd-msys <dheeraj.dubey@msystechnologies.com>2020-05-07 14:16:59 +0530
commit4cde899df21bbf880068688f43fc5abd2d1bc69f (patch)
tree08aa359b2235f49c54becf84febb7aefb77d0a53
parentec53e5ff30344216700ae42f72883477661feb91 (diff)
downloadchef-4cde899df21bbf880068688f43fc5abd2d1bc69f.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 b8a7956358..829f07317b 100644
--- a/lib/chef/resource/windows_feature_powershell.rb
+++ b/lib/chef/resource/windows_feature_powershell.rb
@@ -141,8 +141,8 @@ 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
+ @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 4ee5302947..98737fd631 100644
--- a/spec/unit/resource/windows_feature_powershell_spec.rb
+++ b/spec/unit/resource/windows_feature_powershell_spec.rb
@@ -35,10 +35,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