From 5f825f0d7c0f66aa0796d5ed2220fff289afda2e Mon Sep 17 00:00:00 2001 From: brajjan Date: Thu, 23 May 2024 14:24:42 +0200 Subject: [PATCH 1/2] Issue 198 - Disable Dual Scan Add parameter disable_dual_scan (default undef) to be able to not allow update deferral policies to cause scans against Windows Update when using WSUS server --- manifests/init.pp | 11 +++++++++++ spec/acceptance/wsus_client_spec.rb | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 3d87816..72e0614 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -136,6 +136,10 @@ # This enabled parameter is only respected when the WSUS server allows clients to modify this setting via the TargetGroup and # TargetGroupEnabled registry keys. # +# @param disable_dual_scan +# Enable this policy to not allow update deferral policies to cause scans against Windows Update. +# Valid options: 'true', 'false', and undef. Default: undef. +# class wsus_client ( Optional[Variant[Stdlib::HTTPUrl,Boolean]] $server_url = undef, Optional[Boolean] $enable_status_server = undef, @@ -157,6 +161,7 @@ Optional[Variant[Integer[15,180],Boolean]] $always_auto_reboot_at_scheduled_time_minutes = undef, Boolean $purge_values = false, Optional[Variant[String,Boolean]] $target_group = undef, + Optional[Boolean] $disable_dual_scan = undef, ) { $_basekey = 'HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate' @@ -244,6 +249,12 @@ validate_bool => true, } + wsus_client::setting { "${_basekey}\\DisableDualScan": + data => $disable_dual_scan, + has_enabled => false, + validate_bool => true, + } + wsus_client::setting { "${_basekey}\\ElevateNonAdmins": data => $elevate_non_admins, has_enabled => false, diff --git a/spec/acceptance/wsus_client_spec.rb b/spec/acceptance/wsus_client_spec.rb index 61a10d7..5348f65 100644 --- a/spec/acceptance/wsus_client_spec.rb +++ b/spec/acceptance/wsus_client_spec.rb @@ -314,4 +314,10 @@ def create_apply_manifest(params, clear_first = true) end end end + + context 'with disable_dual_scan =>', testrail: ['70270', '70271'] do + it_behaves_like 'boolean values', + :disable_dual_scan, + 'DisableDualScan' + end end From dddc43d59b4537fa3f2aa0672f68d639976f2fca Mon Sep 17 00:00:00 2001 From: brajjan Date: Fri, 24 May 2024 10:01:53 +0200 Subject: [PATCH 2/2] add spec test for disable_dual_scan --- spec/classes/init_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 289b151..3149504 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -308,6 +308,14 @@ it_behaves_like 'non enabled feature' end + context 'with disable_dual_scan =>' do + let(:reg_key) { "#{base_key}\\DisableDualScan" } + let(:param_sym) { :disable_dual_scan } + + it_behaves_like 'bool value' + it_behaves_like 'non enabled feature' + end + context 'with elevate_non_admins =>' do let(:reg_key) { "#{base_key}\\ElevateNonAdmins" } let(:param_sym) { :elevate_non_admins }