puppet_litmus 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6c8a0cd69ad8f6cfb4eed234dfd6bc8debe88a1a7ef0b2945ff6d21c4addb90
4
- data.tar.gz: c0fa10be3afdcbcca5309f40bcf785c1a3b1156261e329288c63c1aa8f2535f9
3
+ metadata.gz: e97ff4ce76e4656aec5eb55859964253b95e3dd07f46427bd96a3119d959b78b
4
+ data.tar.gz: 8101b71b60904bb20870bc6504296dd86b12e30dd2080f5a45a56bc0a7f232d9
5
5
  SHA512:
6
- metadata.gz: 6bac57d756f85876882d6741cad40f56c386bd99b4d5ea34abd8137beaac21acb94cbc45ed26bba962d4fc7c115952d77f5076e4a8b4b2c233b55ed2cf0fbecb
7
- data.tar.gz: 96dcb4de5adfd5ad7eab0ae916fdb9cc45c937a7758b2ee754d2936b7915bfbc35b2c5c6898e836f3027fa35d9799a77d818dab89cce90aa7da15bd55bbaa13d
6
+ metadata.gz: 1ae92889a2b3c5a46831817810059137e2d069c841a7ae156fcc90ebd112990f6023c33deaab5864dfdca32a64eb34aa83886f6a7cc394a58e20a8c3fb0798e1
7
+ data.tar.gz: b4295446eff91e4fe63256e0a01e093c8c89b80bc38f2a3f507dd3e41aef4ef6404754947428021b4452acd84890099d97a50307ab94a4ffc39dde4f4974f36a
data/exe/matrix.json CHANGED
@@ -76,6 +76,9 @@
76
76
  "Scientific": {
77
77
  "7": { "x86_64": "litmusimage/scientificlinux:7" }
78
78
  },
79
+ "SLES": {
80
+ "15": { "x86_64": "litmusimage/sles:15" }
81
+ },
79
82
  "Ubuntu": {
80
83
  "18.04": { "x86_64": "litmusimage/ubuntu:18.04" },
81
84
  "20.04": { "x86_64": "litmusimage/ubuntu:20.04" },
@@ -86,7 +89,7 @@
86
89
  },
87
90
  "github_runner": {
88
91
  "docker": {
89
- "^(AmazonLinux-2|(CentOS|OracleLinux|Scientific)-7|(AlmaLinux|OracleLinux|Rocky|CentOS)-9|AlmaLinux-8|Fedora-36|Ubuntu-18|Debian-10)": "ubuntu-22.04"
92
+ "^(AmazonLinux-2|(CentOS|OracleLinux|Scientific)-7|(AlmaLinux|OracleLinux|Rocky|CentOS)-9|AlmaLinux-8|Fedora-36|SLES-15|Ubuntu-18|Debian-10)": "ubuntu-22.04"
90
93
  }
91
94
  }
92
95
  }
@@ -281,12 +281,12 @@ options[:metadata]['requirements']&.each do |req|
281
281
  end
282
282
 
283
283
  version = collection['puppet'].to_i
284
- prefix = 'puppetcore'
285
- group = if options[:nightly]
286
- "#{prefix}#{version}-nightly"
287
- else
288
- "#{prefix}#{version}"
289
- end
284
+ forge_token = ENV.fetch('PUPPET_FORGE_TOKEN', nil)
285
+ prefix = forge_token ? 'puppetcore' : 'puppet'
286
+ nightly = options[:nightly] && forge_token
287
+ Action.warning('--nightly ignored: PUPPET_FORGE_TOKEN is not set, falling back to public puppet collection') \
288
+ if options[:nightly] && !forge_token
289
+ group = nightly ? "#{prefix}#{version}-nightly" : "#{prefix}#{version}"
290
290
  matrix[:collection] << if options[:latest_agent] && collection['puppet'] != 'nightly'
291
291
  require 'net/http'
292
292
  require 'json'
@@ -143,8 +143,19 @@ module PuppetLitmus::RakeHelper # rubocop:disable Metrics/ModuleLength
143
143
  raise 'puppetcore agent installs require a valid PUPPET_FORGE_TOKEN set in the env.' \
144
144
  if collection =~ /\Apuppetcore.*/ && !forge_token
145
145
 
146
+ # Fix for SLES systems - ensure credentials file exists before agent installation
147
+ targets.each do |target|
148
+ node_facts = facts_from_node(inventory_hash, target)
149
+ next unless node_facts && node_facts['platform'] =~ /sles/i
150
+
151
+ result = run_command('touch /etc/zypp/credentials.d/PuppetcoreCreds',
152
+ target, config: DEFAULT_CONFIG_DATA, inventory: inventory_hash.clone)
153
+ raise_bolt_errors(result, "Failed to create Puppet credentials file on SLES target #{target}.")
154
+ end
155
+
146
156
  # using boltspec, when the runner is called it changes the inventory_hash dropping the version field. The clone works around this
147
157
  bolt_result = run_task('puppet_agent::install', targets, params, config: DEFAULT_CONFIG_DATA, inventory: inventory_hash.clone)
158
+
148
159
  targets.each do |target|
149
160
  params = {
150
161
  'path' => '/opt/puppetlabs/bin'
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION = '2.4.1'
5
+ VERSION = '2.5.0'
6
6
  end
@@ -232,9 +232,8 @@ RSpec.describe 'matrix_from_metadata_v3' do
232
232
  '::group::matrix',
233
233
  '::group::spec_matrix'
234
234
  )
235
- expect(github_output_content).to include(
236
- '"collection":["2023.8.6-puppet_enterprise","2021.7.9-puppet_enterprise","puppetcore8"'
237
- )
235
+ expect(github_output_content).to match(/"collection":\["\d{4}\.\d\.\d-puppet_enterprise","\d{4}\.\d\.\d-puppet_enterprise","puppetcore8"/)
236
+
238
237
  expect(github_output_content).to include(
239
238
  'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
240
239
  )
@@ -242,7 +241,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
242
241
  end
243
242
 
244
243
  context 'with argument --nightly' do
245
- let(:result) { run_matrix_from_metadata_v3(['--puppetlabs', '--nightly']) }
244
+ let(:result) { run_matrix_from_metadata_v3(['--puppetlabs', '--nightly'], env: { 'PUPPET_FORGE_TOKEN' => 'fake_token' }) }
246
245
  let(:matrix) do
247
246
  [
248
247
  'matrix={',
@@ -281,6 +280,32 @@ RSpec.describe 'matrix_from_metadata_v3' do
281
280
  end
282
281
  end
283
282
 
283
+ context 'with --nightly and no PUPPET_FORGE_TOKEN' do
284
+ let(:result) { run_matrix_from_metadata_v3(['--nightly'], env: { 'PUPPET_FORGE_TOKEN' => nil }) }
285
+
286
+ it 'run successfully' do
287
+ expect(result.status_code).to eq 0
288
+ end
289
+
290
+ it 'falls back to public puppet collection with a warning' do
291
+ expect(result.stdout).to include('--nightly ignored: PUPPET_FORGE_TOKEN is not set, falling back to public puppet collection')
292
+ expect(github_output_content).to include('"collection":["puppet8"]')
293
+ end
294
+ end
295
+
296
+ context 'without PUPPET_FORGE_TOKEN' do
297
+ let(:result) { run_matrix_from_metadata_v3(['--puppetlabs'], env: { 'PUPPET_FORGE_TOKEN' => nil }) }
298
+
299
+ it 'run successfully' do
300
+ expect(result.status_code).to eq 0
301
+ end
302
+
303
+ it 'falls back to public puppet collection' do
304
+ result
305
+ expect(github_output_content).to include('"collection":["puppet8"]')
306
+ end
307
+ end
308
+
284
309
  context 'with argument --latest-agent' do
285
310
  let(:result) { run_matrix_from_metadata_v3(['--puppetlabs', '--latest-agent']) }
286
311
 
@@ -296,6 +321,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
296
321
  '::group::spec_matrix'
297
322
  )
298
323
  expect(github_output_content).to match(/{"collection":"puppetcore8","version":"\d+\.\d+\.\d+"}/)
324
+
299
325
  expect(github_output_content).to include(
300
326
  'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
301
327
  )
data/spec/spec_helper.rb CHANGED
@@ -38,14 +38,14 @@ def run_matrix_from_metadata_v2(options = {})
38
38
  )
39
39
  end
40
40
 
41
- def run_matrix_from_metadata_v3(options = [])
41
+ def run_matrix_from_metadata_v3(options = [], env: {})
42
42
  command = %w[bundle exec ./exe/matrix_from_metadata_v3]
43
43
  unless options.include? '--metadata'
44
44
  options << '--metadata'
45
45
  options << File.join(File.dirname(__FILE__), 'exe', 'fake_metadata.json')
46
46
  end
47
47
  command += options
48
- result = Open3.capture3(*command)
48
+ result = Open3.capture3(env, *command)
49
49
  OpenStruct.new(
50
50
  stdout: result[0],
51
51
  stderr: result[1],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet_litmus
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-14 00:00:00.000000000 Z
11
+ date: 2026-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  - !ruby/object:Gem::Version
185
185
  version: '0'
186
186
  requirements: []
187
- rubygems_version: 3.3.27
187
+ rubygems_version: 3.4.19
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Providing a simple command line tool for puppet content creators, to enable