From 19d435be7c2e63f45f08cd928549162de34e85ee Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Wed, 20 Dec 2023 16:27:12 +0000 Subject: [PATCH] (Bug) - Remove default switch of updateenabled false Prior to this commit, since v3.3.0 of this module, the Install switch /UpdateEnabled always defaulted to FALSE when the instance /ACTION=Install. This took away the ability for users to be able to configure this install switch themselves, and is an obvious bug. Now, this no longer automatically prepends the flag to install switches when action=install, and allows users to configure this through install_switches property once again. --- lib/puppet/provider/sqlserver_features/mssql.rb | 1 - lib/puppet/provider/sqlserver_instance/mssql.rb | 1 - spec/acceptance/sqlserver_config_spec.rb | 1 + spec/acceptance/sqlserver_instance_spec.rb | 3 +++ spec/acceptance/z_last_sqlserver_features_spec.rb | 3 +++ spec/spec_helper_acceptance_local.rb | 2 +- spec/sql_testing_helpers.rb | 2 +- spec/unit/puppet/provider/sqlserver_instance_spec.rb | 4 +--- spec/unit/puppet/sqlserver_spec_helper.rb | 1 - 9 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/puppet/provider/sqlserver_features/mssql.rb b/lib/puppet/provider/sqlserver_features/mssql.rb index 1d01332e..e5cb7176 100644 --- a/lib/puppet/provider/sqlserver_features/mssql.rb +++ b/lib/puppet/provider/sqlserver_features/mssql.rb @@ -67,7 +67,6 @@ def modify_features(action, features) '/IACCEPTSQLSERVERLICENSETERMS', "/FEATURES=#{features.join(',')}"] if action == 'install' - cmd_args << '/UPDATEENABLED=False' cmd_args << "/ISSVCACCOUNT=#{@resource[:is_svc_account]}" if not_nil_and_not_empty?(@resource[:is_svc_account]) cmd_args << "/ISSVCPASSWORD=#{@resource[:is_svc_password]}" if not_nil_and_not_empty?(@resource[:is_svc_password]) cmd_args << "/PID=#{@resource[:pid]}" if not_nil_and_not_empty?(@resource[:pid]) diff --git a/lib/puppet/provider/sqlserver_instance/mssql.rb b/lib/puppet/provider/sqlserver_instance/mssql.rb index 532a212e..3d2320fd 100644 --- a/lib/puppet/provider/sqlserver_instance/mssql.rb +++ b/lib/puppet/provider/sqlserver_instance/mssql.rb @@ -142,7 +142,6 @@ def basic_cmd_args(features, action) '/IACCEPTSQLSERVERLICENSETERMS', "/INSTANCENAME=#{@resource[:name]}"] cmd_args << "/FEATURES=#{features.join(',')}" unless features.empty? - cmd_args << '/UPDATEENABLED=False' if action == 'install' cmd_args end diff --git a/spec/acceptance/sqlserver_config_spec.rb b/spec/acceptance/sqlserver_config_spec.rb index 6bf9a8d3..16139cc5 100644 --- a/spec/acceptance/sqlserver_config_spec.rb +++ b/spec/acceptance/sqlserver_config_spec.rb @@ -22,6 +22,7 @@ def ensure_sqlserver_instance(inst_name, ensure_val = 'present') sa_pwd => 'Pupp3t1@', windows_feature_source => 'I:\\sources\\sxs', install_switches => { + 'UpdateEnabled' => 'false', 'SkipInstallerRunCheck' => 'True', }, } diff --git a/spec/acceptance/sqlserver_instance_spec.rb b/spec/acceptance/sqlserver_instance_spec.rb index e2ba6c4f..d6934415 100644 --- a/spec/acceptance/sqlserver_instance_spec.rb +++ b/spec/acceptance/sqlserver_instance_spec.rb @@ -30,6 +30,9 @@ def ensure_sqlserver_instance(features, inst_name, ensure_val = 'present', sysad agt_svc_account => '#{user}', agt_svc_password => '#{password}', windows_feature_source => 'I:\\sources\\sxs', + install_switches => { + 'UpdateEnabled' => 'false', + }, } MANIFEST idempotent_apply(pp) diff --git a/spec/acceptance/z_last_sqlserver_features_spec.rb b/spec/acceptance/z_last_sqlserver_features_spec.rb index 75881cdb..a0d9eabc 100644 --- a/spec/acceptance/z_last_sqlserver_features_spec.rb +++ b/spec/acceptance/z_last_sqlserver_features_spec.rb @@ -25,6 +25,9 @@ def ensure_sql_features(features, ensure_val = 'present') is_svc_password => '#{password}', features => #{features}, windows_feature_source => 'I:\\sources\\sxs', + install_switches => { + 'UpdateEnabled' => 'false', + } } MANIFEST diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index db2dfd38..f886db7d 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -148,7 +148,7 @@ def install_sqlserver(features) sa_pwd => 'Pupp3t1@', sql_sysadmin_accounts => ['#{USER}'], install_switches => { - 'UPDATEENABLED' => 'False', + 'UpdateEnabled' => 'false', 'TCPENABLED' => 1, 'SQLBACKUPDIR' => 'C:\\MSSQLSERVER\\backupdir', 'SQLTEMPDBDIR' => 'C:\\MSSQLSERVER\\tempdbdir', diff --git a/spec/sql_testing_helpers.rb b/spec/sql_testing_helpers.rb index aacd6f1b..ed07a376 100644 --- a/spec/sql_testing_helpers.rb +++ b/spec/sql_testing_helpers.rb @@ -33,7 +33,7 @@ def install_sqlserver(host, opts = {}) sa_pwd => 'Pupp3t1@', sql_sysadmin_accounts => ['#{user}'], install_switches => { - 'UPDATEENABLED' => 'False', + 'UpdateEnabled' => 'false', 'TCPENABLED' => 1, 'SQLBACKUPDIR' => 'C:\\MSSQLSERVER\\backupdir', 'SQLTEMPDBDIR' => 'C:\\MSSQLSERVER\\tempdbdir', diff --git a/spec/unit/puppet/provider/sqlserver_instance_spec.rb b/spec/unit/puppet/provider/sqlserver_instance_spec.rb index 67edab38..3a8f5fae 100644 --- a/spec/unit/puppet/provider/sqlserver_instance_spec.rb +++ b/spec/unit/puppet/provider/sqlserver_instance_spec.rb @@ -57,8 +57,7 @@ def stub_uninstall(args, installed_features, exit_code = 0) '/Q', '/IACCEPTSQLSERVERLICENSETERMS', "/INSTANCENAME=#{execute_args[:name]}", - "/FEATURES=#{execute_args[:features].join(',')}", - '/UPDATEENABLED=False'] + "/FEATURES=#{execute_args[:features].join(',')}"] (execute_args.keys - ['ensure', 'loglevel', 'features', 'name', 'source', 'sql_sysadmin_accounts', 'sql_security_mode', 'install_switches'].map(&:to_sym)).sort.map do |key| cmd_args << "/#{resourcekey_to_cmdarg[key.to_s]}=\"#{@resource[key]}\"" end @@ -96,7 +95,6 @@ def stub_uninstall(args, installed_features, exit_code = 0) '/ACTION=install', '/Q', '/IACCEPTSQLSERVERLICENSETERMS', - '/UPDATEENABLED=False', "/INSTANCENAME=#{execute_args[:name]}", "/FEATURES=#{execute_args[:features].join(',')}"] (execute_args.keys - ['ensure', 'loglevel', 'features', 'name', 'source', 'sql_sysadmin_accounts', 'sql_security_mode', 'install_switches'].map(&:to_sym)).sort.map do |key| diff --git a/spec/unit/puppet/sqlserver_spec_helper.rb b/spec/unit/puppet/sqlserver_spec_helper.rb index 217776a9..d5d5a872 100644 --- a/spec/unit/puppet/sqlserver_spec_helper.rb +++ b/spec/unit/puppet/sqlserver_spec_helper.rb @@ -23,7 +23,6 @@ def stub_modify_features(action, args, features, additional_switches = [], exit_ '/Q', '/IACCEPTSQLSERVERLICENSETERMS', "/FEATURES=#{features.join(',')}"] - cmds << '/UPDATEENABLED=False' if action == 'install' cmds << "/ISSVCACCOUNT=#{args[:is_svc_account]}" if args.key?(:is_svc_account) cmds << "/ISSVCPASSWORD=#{args[:is_svc_password]}" if args.key?(:is_svc_password) additional_switches.each do |switch|