Skip to content

Commit 19ac362

Browse files
DanyyerDaniel Mayerdamacus
authored
fix: Add SQL Server 2025 support (#227)
--------- Co-authored-by: Daniel Mayer <dmayer@bethel.jw.org> Co-authored-by: Dan Webb <dan.webb@damacus.io>
1 parent d5376f9 commit 19ac362

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ together to maintain important cookbooks. If you’d like to know more please vi
3131
- Microsoft SQL Server 2017
3232
- Microsoft SQL Server 2019
3333
- Microsoft SQL Server 2022
34+
- Microsoft SQL Server 2025
3435

3536
### Supported Client Versions
3637

documentation/sql_server_configure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Properties
88

9-
- `version` - SQL Version of the instance to be configured. Valid options are `2012`, `2016`, `2017`, `2019`, `2022`. Default is `2012`
9+
- `version` - SQL Version of the instance to be configured. Valid options are `2012`, `2016`, `2017`, `2019`, `2022`, `2025`. Default is `2012`
1010
- `tcp_enabled` - If TCP is enabled for the instance. Default is true
1111
- `sql_port` - Port SQL will listen on. Default is 1433
1212
- `tcp_dynamic_ports` - Sets the Dynamic port SQL will listen on. Default is an empty string

libraries/helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def self.reg_version_string(version)
3131
when '2017' then 'MSSQL14.'
3232
when '2019' then 'MSSQL15.'
3333
when '2022' then 'MSSQL16.'
34+
when '2025' then 'MSSQL17.'
3435
else raise "Unsupported sql_server version '#{version}'. Please open a PR to add support for this version."
3536
end
3637
end
@@ -42,6 +43,7 @@ def self.install_dir_version(version)
4243
when '2017' then '140'
4344
when '2019' then '150'
4445
when '2022' then '160'
46+
when '2025' then '170'
4547
else raise "SQL Server version #{version} not supported. Please open a PR to add support for this version."
4648
end
4749
end
@@ -59,6 +61,7 @@ def self.sql_server_url(version, x86_64)
5961
when '2017' then 'https://download.microsoft.com/download/E/F/2/EF23C21D-7860-4F05-88CE-39AA114B014B/SQLEXPR_x64_ENU.exe'
6062
when '2019' then 'https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SQLEXPR_x64_ENU.exe'
6163
when '2022' then 'https://download.microsoft.com/download/5/1/4/5145fe04-4d30-4b85-b0d1-39533663a2f1/SQL2022-SSEI-Expr.exe'
64+
when '2025' then 'https://download.microsoft.com/download/7ab8f535-7eb8-4b16-82eb-eca0fa2d38f3/SQL2025-SSEI-Expr.exe'
6265
end
6366
else
6467
case version.to_s
@@ -75,6 +78,7 @@ def self.sql_server_package_name(version, x86_64)
7578
when '2017' then 'Microsoft SQL Server 2017 (64-bit)'
7679
when '2019' then 'Microsoft SQL Server 2019 (64-bit)'
7780
when '2022' then 'Microsoft SQL Server 2022 (64-bit)'
81+
when '2025' then 'Microsoft SQL Server 2025 (64-bit)'
7882
end
7983
else
8084
case version.to_s
@@ -91,6 +95,7 @@ def self.sql_server_checksum(version, x86_64)
9195
when '2017' then 'F857FF82145E196BF85AF32EEB0193FE38302E57B30BEB54E513630C60D83E0D'
9296
when '2019' then 'bea033e778048748eb1c87bf57597f7f5449b6a15bac55ddc08263c57f7a1ca8'
9397
when '2022' then '36e0ec2ac3dd60f496c99ce44722c629209ea7302a2ce9cbfd1e42a73510d7b6'
98+
when '2025' then '1c677a33b318481c3217128835f8405cf0026621dcd04b13eb6cb0982e823f27'
9499
end
95100
else
96101
case version.to_s

resources/install.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@
162162
::SqlServer::Helper.sql_server_checksum(new_resource.version, x86_64) ||
163163
::Chef::Application.fatal!("No package checksum matches '#{new_resource.version}'. package_checksum property must be set or version property must match a supported version.")
164164

165+
install_options = ['/q', "/ConfigurationFile=#{config_file_path}"]
166+
165167
# Build safe password command line options for the installer
166168
# see http://technet.microsoft.com/library/ms144259
167169
passwords_options = {
@@ -175,14 +177,21 @@
175177
# When the number of double quotes is odd, we need to escape the enclosing quotes
176178
enclosing_escape = safe_password.count('"').odd? ? '^' : ''
177179
"/#{option}=\"#{safe_password}#{enclosing_escape}\""
178-
end.compact.join ' '
180+
end.compact
181+
182+
install_options.push(passwords_options)
183+
184+
# The SQL Server 2025 setup requires /IAcceptSQLServerLicenseTerms to be passed as a parameter not as a ini entry
185+
if new_resource.accept_eula && new_resource.version.to_s == '2025'
186+
install_options.push('/IAcceptSQLServerLicenseTerms')
187+
end
179188

180189
package install_name do
181190
source package_url
182191
checksum install_checksum
183192
timeout new_resource.installer_timeout
184193
installer_type :custom
185-
options "/q /ConfigurationFile=#{config_file_path} #{passwords_options}"
194+
options install_options.join(' ')
186195
action :install
187196
notifies :reboot_now, 'reboot[sql server install]' if new_resource.sql_reboot
188197
returns [0, 42, 127, 3010]

templates/ConfigurationFile.ini.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ QUIET="False"
5858

5959
QUIETSIMPLE="False"
6060

61-
<% if @version != '2022' %>
61+
<% unless %w(2022 2025).include?(@version.to_s) %>
6262
; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.
6363

6464
X86="False"
65-
<% end%>
65+
<% end %>
6666

6767
; Detailed help for command line argument ROLE has not been defined yet.
6868

@@ -330,7 +330,7 @@ EXTSVCACCOUNT="NT Service\MSSQLLaunchpad"
330330
<% end %>
331331
<% end %>
332332

333-
<% if %w(2016 2017 2019 2022).include? @version %>
333+
<% if %w(2016 2017 2019 2022 2025).include? @version %>
334334
; Enables instant file initialization for SQL Server service account.
335335
SQLSVCINSTANTFILEINIT="<%= @sql_instant_file_init ? "True" : "False" %>"
336336

0 commit comments

Comments
 (0)