Skip to content

Commit

Permalink
[sous-chefsGH-476] Windows feature lookup works with dism name and po…
Browse files Browse the repository at this point in the history
…wershell name
  • Loading branch information
dave-q committed Apr 2, 2021
1 parent ae18bf3 commit 17fdcca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libraries/windowsfeature_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def transform_feature_name(install_method, *names)
if install_method.to_sym == :windows_feature_powershell
translated_features = []
names.each do |name|
cmd = "Get-WindowsFeature | Where-Object {$_.AdditionalInfo.InstallName -Eq '#{name}'} | Select -Expand Name"
cmd = "Get-WindowsFeature | Where-Object {$_.AdditionalInfo.InstallName -Eq '#{name}' -or $_.Name -eq '#{name}'} | Select -Expand Name"
result = powershell_out cmd
if result.stderr.empty?
translated_features.push(result.stdout.strip)
Expand Down
8 changes: 4 additions & 4 deletions resources/windows_feature_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,27 @@
default: 600,
desired_state: false

action :delete do
action :install do
feature = transform_feature_name(new_resource.install_method, *new_resource.feature_name)
windows_feature feature do
source new_resource.source
all new_resource.all
management_tools new_resource.management_tools
install_method new_resource.install_method
timeout new_resource.timeout
action :delete
action :install
end
end

action :install do
action :delete do
feature = transform_feature_name(new_resource.install_method, *new_resource.feature_name)
windows_feature feature do
source new_resource.source
all new_resource.all
management_tools new_resource.management_tools
install_method new_resource.install_method
timeout new_resource.timeout
action :install
action :delete
end
end

Expand Down

0 comments on commit 17fdcca

Please sign in to comment.