Skip to content

Commit ddbeaf8

Browse files
committed
changes to discontinue puppet 7 and fixing related files
1 parent d66913a commit ddbeaf8

14 files changed

+66
-55
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88

99
env:
1010
SERVICE_URL: https://facade-maint-config-windows-use-ssh-6f3kfepqcq-ew.a.run.app/v1/provision
11+
PUPPET_FORGE_TOKEN: ${{ secrets.PUPPET_FORGE_TOKEN || secrets.PUPPET_FORGE_TOKEN_PUBLIC }}
12+
BUNDLE_RUBYGEMS___PUPPETCORE__PUPPET__COM: "forge-key:${{ secrets.PUPPET_FORGE_TOKEN || secrets.PUPPET_FORGE_TOKEN_PUBLIC }}"
1113

1214
jobs:
1315
Spec:
@@ -17,8 +19,7 @@ jobs:
1719
setup_matrix:
1820
name: "Setup Test Matrix"
1921
needs: "Spec"
20-
with:
21-
flags: "--nightly"
22+
runs-on: ubuntu-latest
2223
outputs:
2324
matrix: ${{ steps.get-matrix.outputs.matrix }}
2425

@@ -47,22 +48,22 @@ jobs:
4748
- name: Setup Acceptance Test Matrix
4849
id: get-matrix
4950
run: |
50-
bundle exec matrix_from_metadata_v2
51+
bundle exec matrix_from_metadata_v3 --latest-agent
5152
5253
Acceptance:
53-
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
54+
name: "${{ matrix.platforms.label }}, ${{ matrix.collection.collection || matrix.collection }}"
5455
needs:
5556
- setup_matrix
5657
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
5758

58-
with:
59-
flags: "--nightly"
59+
60+
runs-on: ubuntu-latest
6061
strategy:
6162
fail-fast: false
6263
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
6364

6465
env:
65-
PUPPET_GEM_VERSION: '~> 7.24'
66+
PUPPET_GEM_VERSION: '~> 8.9'
6667
FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main'
6768

6869
steps:
@@ -94,7 +95,12 @@ jobs:
9495
9596
- name: Install agent
9697
run: |
97-
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
98+
if [[ "${{ matrix.collection.version }}" ]] ; then
99+
export PUPPET_VERSION=${{ matrix.collection.version }}
100+
bundle exec rake 'litmus:install_agent[${{ matrix.collection.collection }}]'
101+
else
102+
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
103+
fi
98104
99105
- name: Install module
100106
run: |

.github/workflows/nightly.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66

77
env:
88
SERVICE_URL: https://facade-maint-config-windows-use-ssh-6f3kfepqcq-ew.a.run.app/v1/provision
9+
PUPPET_FORGE_TOKEN: ${{ secrets.PUPPET_FORGE_TOKEN || secrets.PUPPET_FORGE_TOKEN_PUBLIC }}
10+
BUNDLE_RUBYGEMS___PUPPETCORE__PUPPET__COM: "forge-key:${{ secrets.PUPPET_FORGE_TOKEN || secrets.PUPPET_FORGE_TOKEN_PUBLIC }}"
911

1012
jobs:
1113
Spec:
@@ -15,8 +17,7 @@ jobs:
1517
setup_matrix:
1618
name: "Setup Test Matrix"
1719
needs: "Spec"
18-
with:
19-
flags: "--nightly"
20+
runs-on: ubuntu-latest
2021
outputs:
2122
matrix: ${{ steps.get-matrix.outputs.matrix }}
2223

@@ -45,16 +46,15 @@ jobs:
4546
- name: Setup Acceptance Test Matrix
4647
id: get-matrix
4748
run: |
48-
bundle exec matrix_from_metadata_v2
49+
bundle exec matrix_from_metadata_v3 --latest-agent
4950
5051
Acceptance:
51-
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
52+
name: "${{ matrix.platforms.label }}, ${{ matrix.collection.collection || matrix.collection }}"
5253
needs:
5354
- setup_matrix
5455
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
5556

56-
with:
57-
flags: "--nightly"
57+
runs-on: ubuntu-latest
5858
strategy:
5959
fail-fast: false
6060
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
@@ -92,7 +92,12 @@ jobs:
9292
9393
- name: Install agent
9494
run: |
95-
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
95+
if [[ "${{ matrix.collection.version }}" ]] ; then
96+
export PUPPET_VERSION=${{ matrix.collection.version }}
97+
bundle exec rake 'litmus:install_agent[${{ matrix.collection.collection }}]'
98+
else
99+
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
100+
fi
96101
97102
- name: Install module
98103
run: |

spec/acceptance/sqlserver_config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def ensure_sqlserver_instance(inst_name, ensure_val = 'present')
8686
hostname = Helper.instance.run_shell('hostname').stdout.upcase.strip
8787
query = "USE #{db_name}; SELECT * from master..sysdatabases WHERE name = '#{db_name}'"
8888

89-
run_sql_query(query: query, server: hostname, instance: inst_name, \
89+
run_sql_query(query:, server: hostname, instance: inst_name, \
9090
sql_admin_user: @admin_user, sql_admin_pass: @admin_pass, expected_row_count: 1)
9191
end
9292

spec/acceptance/sqlserver_database_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
# Return options for run_sql_query
88
def run_sql_query_opts(query, expected_row_count)
99
{
10-
query: query,
10+
query:,
1111
sql_admin_user: 'sa',
1212
sql_admin_pass: 'Pupp3t1@',
13-
expected_row_count: expected_row_count
13+
expected_row_count:
1414
}
1515
end
1616

spec/acceptance/sqlserver_instance_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ def ensure_sqlserver_instance(features, inst_name, ensure_val = 'present', sysad
4141
# Return options for run_sql_query
4242
def run_sql_query_opts(inst_name, query, expected_row_count)
4343
{
44-
query: query,
44+
query:,
4545
instance: inst_name,
4646
server: '.',
4747
sql_admin_user: 'sa',
4848
sql_admin_pass: 'Pupp3t1@',
49-
expected_row_count: expected_row_count
49+
expected_row_count:
5050
}
5151
end
5252

@@ -90,7 +90,7 @@ def sql_query_is_user_sysadmin(username)
9090
host_computer_name = run_shell('CMD /C ECHO %COMPUTERNAME%').stdout.chomp
9191
ensure_sqlserver_instance(features, inst_name, 'present', ["#{host_computer_name}\\#{@extra_admin_user}"])
9292

93-
validate_sql_install(version: version) do |r|
93+
validate_sql_install(version:) do |r|
9494
expect(r.stdout).to match(%r{#{Regexp.new(inst_name)}})
9595
end
9696
end
@@ -107,7 +107,7 @@ def sql_query_is_user_sysadmin(username)
107107
ensure_sqlserver_instance(features, inst_name, 'absent')
108108

109109
# Ensure all features for this instance are removed and the defaults are left alone
110-
validate_sql_install(version: version) do |r|
110+
validate_sql_install(version:) do |r|
111111
expect(r.stdout).to match(%r{MSSQLSERVER\s+Database Engine Services})
112112
expect(r.stdout).to match(%r{MSSQLSERVER\s+SQL Server Replication})
113113
expect(r.stdout).to match(%r{MSSQLSERVER\s+Data Quality Services})
@@ -129,7 +129,7 @@ def sql_query_is_user_sysadmin(username)
129129
it "create #{inst_name} instance with only one RS feature", unless: version.to_i >= 2017 do
130130
ensure_sqlserver_instance(features, inst_name)
131131

132-
validate_sql_install(version: version) do |r|
132+
validate_sql_install(version:) do |r|
133133
expect(r.stdout).to match(%r{#{inst_name}\s+Reporting Services})
134134
end
135135
end

spec/acceptance/sqlserver_login_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
# Return options for run_sql_query
1212
def run_sql_query_opts(user, passwd, query, expected_row_count)
1313
{
14-
query: query,
14+
query:,
1515
sql_admin_user: user,
1616
sql_admin_pass: passwd,
17-
expected_row_count: expected_row_count
17+
expected_row_count:
1818
}
1919
end
2020

spec/acceptance/sqlserver_role_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
# database name
1010
db_name = "DB#{SecureRandom.hex(4)}".upcase
11-
LOGIN1 = "Login1_#{SecureRandom.hex(2)}"
12-
LOGIN2 = "Login2_#{SecureRandom.hex(2)}"
13-
LOGIN3 = "Login3_#{SecureRandom.hex(2)}"
14-
USER1 = "User1_#{SecureRandom.hex(2)}"
11+
LOGIN1 = "Login1_#{SecureRandom.hex(2)}".freeze
12+
LOGIN2 = "Login2_#{SecureRandom.hex(2)}".freeze
13+
LOGIN3 = "Login3_#{SecureRandom.hex(2)}".freeze
14+
USER1 = "User1_#{SecureRandom.hex(2)}".freeze
1515

1616
describe 'Test sqlserver::role' do
1717
def ensure_sqlserver_logins_users(db_name)
@@ -108,7 +108,7 @@ def ensure_sqlserver_logins_users(db_name)
108108
ON spe.grantee_principal_id = spr.principal_id
109109
WHERE spr.name = '#{@role}';"
110110

111-
run_sql_query(query: query, server: hostname, expected_row_count: 2)
111+
run_sql_query(query:, server: hostname, expected_row_count: 2)
112112

113113
# validate that the database-specific role '#{@role}' has correct authorization #{LOGIN1}
114114
query = "USE #{db_name};
@@ -118,7 +118,7 @@ def ensure_sqlserver_logins_users(db_name)
118118
ON spr.owning_principal_id = sl.principal_id
119119
WHERE sl.name = '#{LOGIN1}';"
120120

121-
run_sql_query(query: query, server: hostname, expected_row_count: 1)
121+
run_sql_query(query:, server: hostname, expected_row_count: 1)
122122
end
123123

124124
it "Create database-specific role #{@role}" do
@@ -146,7 +146,7 @@ def ensure_sqlserver_logins_users(db_name)
146146
ON pe.grantee_principal_id = pr.principal_id
147147
WHERE pr.name = '#{@role}';"
148148

149-
run_sql_query(query: query, server: hostname, expected_row_count: 6)
149+
run_sql_query(query:, server: hostname, expected_row_count: 6)
150150
end
151151

152152
it 'Create a database-specific role with the same name on two databases' do
@@ -184,7 +184,7 @@ def ensure_sqlserver_logins_users(db_name)
184184
on pr.name = dbpr.name
185185
WHERE pr.name = '#{@role}';"
186186

187-
run_sql_query(query: query, server: hostname, expected_row_count: 6)
187+
run_sql_query(query:, server: hostname, expected_row_count: 6)
188188
end
189189

190190
it "Create server role #{@role} with optional members and optional members-purge" do
@@ -213,7 +213,7 @@ def ensure_sqlserver_logins_users(db_name)
213213
ON spe.grantee_principal_id = spr.principal_id
214214
WHERE spr.name = '#{@role}';"
215215

216-
run_sql_query(query: query, server: hostname, expected_row_count: 2)
216+
run_sql_query(query:, server: hostname, expected_row_count: 2)
217217

218218
# validate that the t server role '#{@role}' has correct members (Login1, 2, 3)
219219
query = "USE #{db_name};
@@ -226,7 +226,7 @@ def ensure_sqlserver_logins_users(db_name)
226226
OR spr.name = '#{LOGIN3}'
227227
OR spr.name = 'LOGIN4';"
228228

229-
run_sql_query(query: query, server: hostname, expected_row_count: 3)
229+
run_sql_query(query:, server: hostname, expected_row_count: 3)
230230

231231
puts "Create server role #{@role} with optional members_purge:"
232232
pp = <<-MANIFEST
@@ -256,7 +256,7 @@ def ensure_sqlserver_logins_users(db_name)
256256
OR spr.name = '#{LOGIN2}'
257257
OR spr.name = '#{LOGIN3}';"
258258

259-
run_sql_query(query: query, server: hostname, expected_row_count: 1)
259+
run_sql_query(query:, server: hostname, expected_row_count: 1)
260260
end
261261
end
262262
end

spec/acceptance/sqlserver_tsql_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
db_name = "DB#{SecureRandom.hex(4)}".upcase
1111

1212
# database user:
13-
DB_LOGIN_USER = "loginuser#{SecureRandom.hex(2)}"
13+
DB_LOGIN_USER = "loginuser#{SecureRandom.hex(2)}".freeze
1414

1515
describe 'sqlserver_tsql test' do
1616
def ensure_sqlserver_database(db_name, _ensure_val = 'present')

spec/acceptance/sqlserver_user_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def ensure_sqlserver_database(db_name, _ensure_val = 'present')
7171
WHERE name = '#{@db_user}'
7272
AND
7373
default_schema_name = 'guest';"
74-
run_sql_query(query: query, server: hostname, expected_row_count: 1)
74+
run_sql_query(query:, server: hostname, expected_row_count: 1)
7575
end
7676

7777
it 'Create database user with optional instance' do
@@ -99,7 +99,7 @@ def ensure_sqlserver_database(db_name, _ensure_val = 'present')
9999
SELECT name AS Database_User_Name
100100
FROM SYS.DATABASE_PRINCIPALS
101101
WHERE name = '#{@db_user}';"
102-
run_sql_query(query: query, server: hostname, expected_row_count: 1)
102+
run_sql_query(query:, server: hostname, expected_row_count: 1)
103103
end
104104

105105
it 'Create database user with optional login' do
@@ -129,7 +129,7 @@ def ensure_sqlserver_database(db_name, _ensure_val = 'present')
129129
FROM SYS.DATABASE_PRINCIPALS d, MASTER.SYS.SQL_LOGINS l
130130
WHERE d.sid = l.sid
131131
AND d.name = '#{@db_user}';"
132-
run_sql_query(query: query, server: hostname, expected_row_count: 1)
132+
run_sql_query(query:, server: hostname, expected_row_count: 1)
133133
end
134134

135135
it 'Create database user with optional password' do
@@ -156,7 +156,7 @@ def ensure_sqlserver_database(db_name, _ensure_val = 'present')
156156

157157
puts "validate that the database user '#{@db_user}' is successfully created:"
158158
query = "USE #{db_name}; SELECT * FROM SYS.DATABASE_PRINCIPALS WHERE name = '#{@db_user}';"
159-
run_sql_query(query: query, server: hostname, expected_row_count: 1)
159+
run_sql_query(query:, server: hostname, expected_row_count: 1)
160160
end
161161

162162
it 'Delete database user' do
@@ -179,7 +179,7 @@ def ensure_sqlserver_database(db_name, _ensure_val = 'present')
179179

180180
# validate that the database user '#{@db_user}' is successfully created:
181181
query = "USE #{db_name}; SELECT * FROM SYS.DATABASE_PRINCIPALS WHERE name = '#{@db_user}';"
182-
run_sql_query(query: query, server: hostname, expected_row_count: 1)
182+
run_sql_query(query:, server: hostname, expected_row_count: 1)
183183

184184
pp = <<-MANIFEST
185185
sqlserver::config{'MSSQLSERVER':
@@ -194,7 +194,7 @@ def ensure_sqlserver_database(db_name, _ensure_val = 'present')
194194
apply_manifest(pp, catch_failures: true)
195195
# validate that the database user '#{@db_user}' should be deleted:
196196
query = "USE #{db_name}; SELECT * FROM SYS.DATABASE_PRINCIPALS WHERE name = '#{@db_user}';"
197-
run_sql_query(query: query, server: hostname, expected_row_count: 0)
197+
run_sql_query(query:, server: hostname, expected_row_count: 0)
198198
end
199199
end
200200
end

spec/acceptance/z_last_sqlserver_features_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def bind_and_apply_failing_manifest(features, ensure_val = 'present')
6969
it 'all possible features' do
7070
ensure_sql_features(features)
7171

72-
validate_sql_install(version: version) do |r|
72+
validate_sql_install(version:) do |r|
7373
# Client Tools removed in Server2022
7474
unless version.to_i == 2022
7575
expect(r.stdout).to match(%r{Client Tools Connectivity})
@@ -94,7 +94,7 @@ def bind_and_apply_failing_manifest(features, ensure_val = 'present')
9494
it 'all possible features' do
9595
ensure_sql_features(features, 'absent')
9696

97-
validate_sql_install(version: version) do |r|
97+
validate_sql_install(version:) do |r|
9898
# Client Tools removed in Server2022
9999
unless version.to_i == 2022
100100
expect(r.stdout).not_to match(%r{Client Tools Connectivity})
@@ -127,15 +127,15 @@ def bind_and_apply_failing_manifest(features, ensure_val = 'present')
127127
it "'BC'", unless: version.to_i == 2022 do
128128
ensure_sql_features(features - ['BC'])
129129

130-
validate_sql_install(version: version) do |r|
130+
validate_sql_install(version:) do |r|
131131
expect(r.stdout).not_to match(%r{Client Tools Backwards Compatibility})
132132
end
133133
end
134134

135135
it "'ADV_SSMS'", unless: version.to_i >= 2016 do
136136
ensure_sql_features(features - ['ADV_SSMS'])
137137

138-
validate_sql_install(version: version) do |r|
138+
validate_sql_install(version:) do |r|
139139
expect(r.stdout).not_to match(%r{Management Tools - Complete})
140140

141141
# also verify SSMS is still present
@@ -146,7 +146,7 @@ def bind_and_apply_failing_manifest(features, ensure_val = 'present')
146146
it "'SDK' + 'IS", unless: version.to_i == 2022 do
147147
ensure_sql_features(features - ['SDK', 'IS'])
148148

149-
validate_sql_install(version: version) do |r|
149+
validate_sql_install(version:) do |r|
150150
expect(r.stdout).not_to match(%r{Client Tools SDK})
151151
end
152152
end
@@ -199,7 +199,7 @@ def remove_sql_instance
199199
it 'all possible features' do
200200
ensure_sql_features(features)
201201

202-
validate_sql_install(version: version) do |r|
202+
validate_sql_install(version:) do |r|
203203
# SQL Server 2016+ will not install the client tools features.
204204
expect(r.stdout).not_to match(%r{MSSQLSERVER\s+Database Engine Services})
205205
expect(r.stdout).not_to match(%r{MSSQLSERVER\s+SQL Server Replication})

0 commit comments

Comments
 (0)