criteo-cookbooks / wsus-server

Chef Cookbook to install and configure server for Windows Server Update Services (WSUS)
Apache License 2.0
15 stars 14 forks source link

Install-WindowsFeature ... -IncludeAllSubFeature produces conflict #26

Closed dayglojesus closed 7 years ago

dayglojesus commented 7 years ago

When using a simple wsus-server::install or wsus-server::default, I receive the error:

 1. Feature WID Database has a conflict with the features Database.
 2. Feature Database has a conflict with the features WID Database.
 At line:1 char:1
 + Install-WindowsFeature -Name UpdateServices -IncludeAllSubFeature ...
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~
 + CategoryInfo : InvalidArgument: (System.Collecti...usionConflic
 ts]:List`1) [Install-WindowsFeature], Exception
 + FullyQualifiedErrorId : MutualExclusionConflictsFound,Microsoft.Windows.
 ServerManager.Commands.AddWindowsFeatureCommand

Basically, Windows cannot resolve the -IncludeAllSubFeature arg because both WSUS database choices (WID and SQL) fall under the category UpdateServices.

One simple fix for this conflict is to remove the UpdateServices, element from the Array (line 45) and simply pass:

require 'chef/win32/version'
if node['platform_version'].to_f >= 6.2
  [
    'NET-WCF-HTTP-Activation45', # This feature is required for KB3159706
    'UpdateServices-UI',
  ].each do |feature_name|
    windows_feature feature_name do
      action         :install
      all            true
      install_method :windows_feature_powershell if respond_to? :install_method
      provider       :windows_feature_powershell unless respond_to? :install_method
    end
  end
...
end

However, it may in fact be better to supply a default database choice (WID), supply an attribute to control which database option to use and adjust the conditional install logic accordingly.

Happy to supply a patch for either.

neilfrawley commented 7 years ago

+1 I'm receiving this error too.

dschrander commented 7 years ago

+1 same here (Server 2016)

Annih commented 7 years ago

Weird, I'm also running on a Windows Server 2016 and don't encounter your issue. Could you tell me which DB you want to use? WID or SQL?

Could you also copy/paste the whole stacktrace, I want to check the line at which the PowerShell script has been defined

Annih commented 7 years ago

OK I think I understand... I'm still using windows 2.1.1 and the behavior of the all attribute on the PowerShell install_method is completely different from the DISM one. I'm logging an issue on the windows cookbook.

Annih commented 7 years ago

@dayglojesus @dschrander & @neilfrawley Let me know if this is better. I'll try to release a minor version quickly.