criteo-cookbooks / wsus-client

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

Wsus service always restart when node['wsus_client']['update_group'] is nil #27

Closed lbn-chef-team closed 5 years ago

lbn-chef-team commented 7 years ago

Hello,

meet this problem at each run:

Recipe: wsus-client::configure
  * registry_key[HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate] action create
    - set value {:type=>:string, :name=>"TargetGroup", :data=>nil}
  * windows_service[wuauserv] action restart
    - restart service windows_service[wuauserv]
  * powershell_script[Force Windows update detection cycle] action run
    - execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/ADMINI~1/AppData/Local/Temp/2/chef-script20170206-2912-qmkai4.ps1"

the cause is from: https://github.com/criteo-cookbooks/wsus-client/blob/master/recipes/configure.rb

on line 54:

    { type: :string, name:  'TargetGroup', data: conf['update_group'] },

should be:

    { type: :string, name: 'TargetGroup', data: conf['update_group'] ? conf['update_group'] : '' },

to be idempotent when node['wsus_client']['update_group'] is nil.

Regards,

jmauro commented 7 years ago

Hello @lbn-aaio-team,

Thanks for the report, we'll look into it and keep you posted.

Regards, JM

rosario-mattera commented 7 years ago

Hi, I'm facing the same behavior. Is it normal?

Regards, Rosario

Annih commented 7 years ago

Hello,

Hum, no this is not normal.

lbn-chef-team commented 7 years ago

Hello,

it seems that v2.0.0 does not fix the problem and this resource still not idempotent. I think the following modification is not correct: https://github.com/criteo-cookbooks/wsus-client/commit/43a6e78aee79994493da91964cb29607fdab5fce

should be { type: :string, name: 'TargetGroup', data: conf['update_group'] || '' }, or { type: :string, name: 'TargetGroup', data: conf['update_group'] ? conf['update_group'] : '' },

Regards,

Annih commented 7 years ago

The fix is clearly wrong.

axelrtgs commented 5 years ago

there is a PR already that fixes this, merging it would be nice.

Annih commented 5 years ago

Released in 2.0.2

axelrtgs commented 5 years ago

Thanks