Skip to content

Commit 05405de

Browse files
committed
(MODULES-8438) Install 2019
This change allows the module to install and uninstall SQL 2019 idempotently. No further support is implemented.
1 parent 37dd499 commit 05405de

File tree

9 files changed

+36
-15
lines changed

9 files changed

+36
-15
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66

77
## [Unreleased]
88

9+
## Added
10+
11+
- Add support for installing and managing SQL 2019 instances ([MODULES-8438](https://tickets.puppetlabs.com/browse/MODULES-8438))
12+
913
## [2.2.0] - 2018-12-3
1014

1115
### Added

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
## Overview
2222

23-
The sqlserver module installs and manages Microsoft SQL Server 2012, 2014, 2016 and 2017 on Windows systems.
23+
The sqlserver module installs and manages Microsoft SQL Server 2012, 2014, 2016, 2017, 2019 on Windows systems.
2424

2525
## Module Description
2626

@@ -392,15 +392,15 @@ Default: `undef`.
392392

393393
##### `polybase_svc_account`
394394

395-
**Applicable only if the POLYBASE feature for SQL Server 2016 is being installed.**
395+
**Applicable only if the POLYBASE feature for SQL Server 2016 or above is being installed.**
396396

397397
Specifies a domain or system account for the Polybase Engine service.
398398

399399
Valid options: a string specifying an existing username.
400400

401401
##### `polybase_svc_password`
402402

403-
**Applicable only if the POLYBASE feature for SQL Server 2016 is being installed.**
403+
**Applicable only if the POLYBASE feature for SQL Server 2016 or above is being installed.**
404404

405405
Specifies the password for the Polybase Engine service
406406

@@ -1068,9 +1068,9 @@ Terminology differs somewhat between various database systems; please refer to t
10681068

10691069
## Limitations
10701070

1071-
SQL 2017 detection support has been added. This support is limited to functionality already present for other versions. No new SQL 2017 specific functionality has been added in this release.
1071+
SQL 2017 and 2019 detection support has been added. This support is limited to functionality already present for other versions. No new SQL 2017 or above specific functionality has been added in this release.
10721072

1073-
This module can manage only a single version of SQL Server on a given host (one and only one of SQL Server 2012, 2014 or 2016). The module is able to manage multiple SQL Server instances of the same version.
1073+
This module can manage only a single version of SQL Server on a given host (one and only one of SQL Server 2012, 2014, 2016, 2017, or 2019). The module is able to manage multiple SQL Server instances of the same version.
10741074

10751075
This module cannot manage the SQL Server Native Client SDK (also known as SNAC_SDK). The SQL Server installation media can install the SDK, but it is not able to uninstall the SDK. Note that the 'sqlserver_features' fact detects the presence of the SDK.
10761076

lib/puppet/provider/sqlserver_features/mssql.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ def create
122122
warn "Uninstalling all sql server features not tied into an instance because an empty array was passed, please use ensure absent instead."
123123
destroy
124124
else
125-
instance_version = PuppetX::Sqlserver::ServerHelper.sql_version_from_install_source(@resource[:source])
126125
Puppet.debug("Installation source detected as version #{instance_version}") unless instance_version.nil?
127126

128-
installNet35(@resource[:windows_feature_source]) unless instance_version == SQL_2016
127+
installNet35(@resource[:windows_feature_source]) unless net35_not_required?
129128

130129
debug "Installing features #{@resource[:features]}"
131130
add_features(@resource[:features])
@@ -158,5 +157,11 @@ def features=(new_features)
158157
self.features
159158
end
160159

160+
def net35_not_required?
161+
instance_version = PuppetX::Sqlserver::ServerHelper.sql_version_from_install_source(@resource[:source])
162+
Puppet.debug("Installation source detected as version #{instance_version}") unless instance_version.nil?
163+
[SQL_2016, SQL_2017, SQL_2019].include? instance_version
164+
end
165+
161166
end
162167

lib/puppet/provider/sqlserver_instance/mssql.rb

+7-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ def create
9898
fail('The parameter polybase_svc_password was specified however the POLYBASE feature was not included in the installed features. Either remove the polybase_svc_password parameter or add POLYBASE as a feature to the instance.')
9999
end
100100

101-
instance_version = PuppetX::Sqlserver::ServerHelper.sql_version_from_install_source(@resource[:source])
102-
Puppet.debug("Installation source detected as version #{instance_version}") unless instance_version.nil?
103-
104-
installNet35(@resource[:windows_feature_source]) unless instance_version == SQL_2016
101+
installNet35(@resource[:windows_feature_source]) unless net35_not_required?
105102

106103
add_features(@resource[:features])
107104
end
@@ -212,4 +209,10 @@ def features=(new_features)
212209
self.features
213210
end
214211

212+
def net35_not_required?
213+
instance_version = PuppetX::Sqlserver::ServerHelper.sql_version_from_install_source(@resource[:source])
214+
Puppet.debug("Installation source detected as version #{instance_version}") unless instance_version.nil?
215+
[SQL_2016, SQL_2017, SQL_2019].include? instance_version
216+
end
217+
215218
end

lib/puppet/type/sqlserver_instance.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@
110110
end
111111

112112
newparam(:polybase_svc_account, :parent => Puppet::Property::SqlserverLogin) do
113-
desc 'The account used by the Polybase Engine service. Only applicable for SQL Server 2016.'
113+
desc 'The account used by the Polybase Engine service. Only applicable for SQL Server 2016+.'
114114

115115
end
116116

117117
newparam(:polybase_svc_password) do
118-
desc 'The password for the Polybase Engine service account. Only applicable for SQL Server 2016.'
118+
desc 'The password for the Polybase Engine service account. Only applicable for SQL Server 2016+.'
119119

120120
end
121121

lib/puppet_x/sqlserver/features.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
SQL_2014 ||= 'SQL_2014'
55
SQL_2016 ||= 'SQL_2016'
66
SQL_2017 ||= 'SQL_2017'
7+
SQL_2019 ||= 'SQL_2019'
78

8-
ALL_SQL_VERSIONS ||= [SQL_2012, SQL_2014, SQL_2016, SQL_2017]
9+
ALL_SQL_VERSIONS ||= [SQL_2012, SQL_2014, SQL_2016, SQL_2017, SQL_2019]
910

1011
module PuppetX
1112
module Sqlserver
@@ -32,6 +33,10 @@ class Features
3233
SQL_2017 => {
3334
:major_version => 14,
3435
:registry_path => '140',
36+
},
37+
SQL_2019 => {
38+
:major_version => 15,
39+
:registry_path => '150',
3540
}
3641
}
3742

lib/puppet_x/sqlserver/server_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def self.sql_version_from_install_source(source_dir)
4242
ver = content.match('"(.+)"')
4343
return nil if ver.nil?
4444

45+
return SQL_2019 if ver[1].start_with?('15.')
46+
return SQL_2017 if ver[1].start_with?('14.')
4547
return SQL_2016 if ver[1].start_with?('13.')
4648
return SQL_2014 if ver[1].start_with?('12.')
4749
return SQL_2012 if ver[1].start_with?('11.')

metadata.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "puppetlabs-sqlserver",
33
"version": "2.2.0",
44
"author": "Puppet Inc",
5-
"summary": "The `sqlserver` module installs and manages MS SQL Server 2012, 2014, 2016 and 2017 on Windows systems.",
5+
"summary": "The `sqlserver` module installs and manages MS SQL Server 2012, 2014, 2016, 2017, and 2019 on Windows systems.",
66
"license": "proprietary",
77
"source": "https://github.com/puppetlabs/puppetlabs-sqlserver",
88
"project_page": "https://github.com/puppetlabs/puppetlabs-sqlserver",
@@ -38,6 +38,7 @@
3838
"sql2014",
3939
"sql2016",
4040
"sql2017",
41+
"sql2019",
4142
"tsql",
4243
"database"
4344
],

spec/spec_helper_acceptance.rb

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
WIN_ISO_ROOT = "http://int-resources.ops.puppetlabs.net/ISO/Windows/2012"
1212
WIN_2012R2_ISO = "en_windows_server_2012_r2_with_update_x64_dvd_6052708.iso"
1313
QA_RESOURCE_ROOT = "http://int-resources.ops.puppetlabs.net/QA_resources/microsoft_sql/iso/"
14+
SQL_2019_ISO = "en_sql_server_2019_developer_x64_CTP2.iso"
1415
SQL_2016_ISO = "en_sql_server_2016_enterprise_with_service_pack_1_x64_dvd_9542382.iso"
1516
SQL_2014_ISO = "SQLServer2014-x64-ENU.iso"
1617
SQL_2012_ISO = "SQLServer2012SP1-FullSlipstream-ENU-x64.iso"

0 commit comments

Comments
 (0)