puppet_litmus 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d77bde09896757aa35ff61163febb315e2d50682b1b2dcdfdbc53b77da576c8
4
- data.tar.gz: d80089f753244e77bf491e4bc9ac14a42e6ae112a85d4b6f41206c38b22b7a07
3
+ metadata.gz: 51e321964b54828b1e0c5602fd6038e8efe1fcd0190bd9c1ada036954b66e8db
4
+ data.tar.gz: f5179463919201def0ff7a033f061dea91755a91c035b5fffc6222cdb8ce1359
5
5
  SHA512:
6
- metadata.gz: 31a2ac1b11fb651d06de17648e345fbab6105ceb92ff9da52632bba725f1689a111219040e5dacf25cc775382ea15c3845167318a45a953cfb33ab1ebf509d30
7
- data.tar.gz: 108b085470b7d07a438c105871300f9a5a759443592073239c4c4d9c8648207c51774c9689a951ef3adc4b70796cada4f47b4f3263c295fde5aafa99f41ac472
6
+ metadata.gz: ff4f3114a21e708537908e577ce0d3361c6075d980eb1bd3bb13f680d526e0eaa2e6ecf64291864e8042e43b18e4a9df88b0098c53c3879a5d79390ffff1ddf6
7
+ data.tar.gz: 0a3177a69170a3687e33820f8fbe21c89b6a00fc999ad800ecf2921b2f0452e06644833df5a5a98e3f3aa51cbdcca87d3e0a8f85476d4bcf9d7dde09ce5441a2
@@ -19,9 +19,10 @@ DOCKER_PLATFORMS = {
19
19
  'CentOS-6' => 'litmusimage/centos:6',
20
20
  'CentOS-7' => 'litmusimage/centos:7',
21
21
  'CentOS-8' => 'litmusimage/centos:8',
22
- 'Debian-10' => 'litmusimage/debian:10',
23
22
  # 'Debian-8' => 'litmusimage/debian:8', Removing from testing: https://puppet.com/docs/pe/2021.0/supported_operating_systems.html
24
23
  'Debian-9' => 'litmusimage/debian:9',
24
+ 'Debian-10' => 'litmusimage/debian:10',
25
+ 'Debian-11' => 'litmusimage/debian:11',
25
26
  'OracleLinux-6' => 'litmusimage/oraclelinux:6',
26
27
  'OracleLinux-7' => 'litmusimage/oraclelinux:7',
27
28
  'Scientific-6' => 'litmusimage/scientificlinux:6',
@@ -6,8 +6,8 @@ module PuppetLitmus; end # rubocop:disable Style/Documentation
6
6
  module PuppetLitmus::InventoryManipulation
7
7
  # Creates an inventory hash from the inventory.yaml.
8
8
  #
9
- # @param inventory_full_path [String] path to the inventory.yaml file
10
- # @return [Hash] hash of the inventory.yaml file.
9
+ # @param inventory_full_path [String] path to the litmus_inventory.yaml file
10
+ # @return [Hash] hash of the litmus_inventory.yaml file.
11
11
  def inventory_hash_from_inventory_file(inventory_full_path = nil)
12
12
  require 'yaml'
13
13
  inventory_full_path = if inventory_full_path.nil?
@@ -464,7 +464,7 @@ module PuppetLitmus::RakeHelper
464
464
 
465
465
  class LitmusTimeoutError < StandardError; end
466
466
 
467
- def with_retries(options: { tries: Float::INFINITY }, max_wait_minutes: 8)
467
+ def with_retries(options: { tries: Float::INFINITY }, max_wait_minutes: 15)
468
468
  stop = Time.now + (max_wait_minutes * 60)
469
469
  Retryable.retryable(options.merge(not: [LitmusTimeoutError])) do
470
470
  raise LitmusTimeoutError if Time.now > stop
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION ||= '0.27.0'
5
+ VERSION ||= '0.28.0'
6
6
  end
@@ -14,7 +14,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
14
14
 
15
15
  it 'calls all functions' do
16
16
  expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
17
- expect(self).to receive(:apply_manifest).with(nil, expect_failures: false, manifest_file_location: '/bla.pp')
17
+ expect(self).to receive(:apply_manifest).with(nil, catch_failures: true, manifest_file_location: '/bla.pp')
18
18
  expect(self).to receive(:apply_manifest).with(nil, catch_changes: true, manifest_file_location: '/bla.pp')
19
19
  idempotent_apply(manifest)
20
20
  end
@@ -24,10 +24,15 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
24
24
  context 'when specifying a hiera config' do
25
25
  let(:manifest) { "include '::doot'" }
26
26
  let(:result) { ['value' => { 'exit_code' => 0, 'stdout' => nil, 'stderr' => nil }] }
27
- let(:command) { " puppet apply /bla.pp --trace --modulepath #{Dir.pwd}/spec/fixtures/modules --hiera_config='/hiera.yaml'" }
27
+ let :os do
28
+ {
29
+ family: 'redhat',
30
+ }
31
+ end
32
+ let(:command) { "LC_ALL=en_US.UTF-8 puppet apply /bla.pp --trace --modulepath #{Dir.pwd}/spec/fixtures/modules --hiera_config='/hiera.yaml'" }
28
33
 
29
34
  it 'passes the --hiera_config flag if the :hiera_config opt is specified' do
30
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
35
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
31
36
  expect(self).to receive(:target_in_inventory?).and_return(true)
32
37
  expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
33
38
  expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
@@ -38,10 +43,15 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
38
43
  context 'when using detailed-exitcodes' do
39
44
  let(:manifest) { "include '::doot'" }
40
45
  let(:result) { ['value' => { 'exit_code' => 0, 'stdout' => nil, 'stderr' => nil }] }
41
- let(:command) { " puppet apply /bla.pp --trace --modulepath #{Dir.pwd}/spec/fixtures/modules --detailed-exitcodes" }
46
+ let(:command) { "LC_ALL=en_US.UTF-8 puppet apply /bla.pp --trace --modulepath #{Dir.pwd}/spec/fixtures/modules --detailed-exitcodes" }
47
+ let :os do
48
+ {
49
+ family: 'redhat',
50
+ }
51
+ end
42
52
 
43
53
  it 'uses detailed-exitcodes with expect_failures' do
44
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
54
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
45
55
  expect(self).to receive(:target_in_inventory?).and_return(true)
46
56
  expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
47
57
  expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
@@ -49,7 +59,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
49
59
  end
50
60
 
51
61
  it 'uses detailed-exitcodes with catch_failures' do
52
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
62
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
53
63
  expect(self).to receive(:target_in_inventory?).and_return(true)
54
64
  expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
55
65
  expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
@@ -57,7 +67,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
57
67
  end
58
68
 
59
69
  it 'uses detailed-exitcodes with expect_changes' do
60
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
70
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
61
71
  expect(self).to receive(:target_in_inventory?).and_return(true)
62
72
  expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
63
73
  expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
@@ -65,7 +75,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
65
75
  end
66
76
 
67
77
  it 'uses detailed-exitcodes with catch_changes' do
68
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
78
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
69
79
  expect(self).to receive(:target_in_inventory?).and_return(true)
70
80
  expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
71
81
  expect(self).to receive(:run_command).with(command, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
@@ -90,7 +100,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
90
100
  context 'when running against localhost and no inventory.yaml file' do
91
101
  it 'does run_shell against localhost without error' do
92
102
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'localhost'))
93
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
103
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
94
104
  expect(self).to receive(:target_in_inventory?).and_return(true)
95
105
  expect(self).to receive(:run_command).with(command_to_run, 'litmus_localhost', config: nil, inventory: localhost_inventory_hash).and_return(result)
96
106
  expect { run_shell(command_to_run) }.not_to raise_error
@@ -100,7 +110,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
100
110
  context 'when running against remote host' do
101
111
  it 'does run_shell against remote host without error' do
102
112
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
103
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
113
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
104
114
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
105
115
  expect(self).to receive(:target_in_inventory?).and_return(true)
106
116
  expect(self).to receive(:run_command).with(command_to_run, 'some.host', config: nil, inventory: inventory_hash).and_return(result)
@@ -125,7 +135,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
125
135
  context 'when upload returns success' do
126
136
  it 'does upload_file against remote host without error' do
127
137
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
128
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
138
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
129
139
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
130
140
  expect(self).to receive(:target_in_inventory?).and_return(true)
131
141
  expect(self).to receive(:upload_file).with(local, remote, 'some.host', options: {}, config: nil, inventory: inventory_hash).and_return(result_success)
@@ -134,7 +144,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
134
144
 
135
145
  it 'does upload_file against localhost without error' do
136
146
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'localhost'))
137
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
147
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
138
148
  expect(self).not_to receive(:inventory_hash_from_inventory_file)
139
149
  expect(self).to receive(:target_in_inventory?).and_return(true)
140
150
  expect(self).to receive(:upload_file).with(local, remote, 'litmus_localhost', options: {}, config: nil, inventory: localhost_inventory_hash).and_return(result_success)
@@ -145,7 +155,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
145
155
  context 'when upload returns failure' do
146
156
  it 'does upload_file gives runtime error for failure' do
147
157
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
148
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
158
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
149
159
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
150
160
  expect(self).to receive(:target_in_inventory?).and_return(true)
151
161
  expect(self).to receive(:upload_file).with(local, remote, 'some.host', options: {}, config: nil, inventory: inventory_hash).and_return(result_failure)
@@ -154,7 +164,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
154
164
 
155
165
  it 'returns the exit code and error message when expecting failure' do
156
166
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
157
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
167
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
158
168
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
159
169
  expect(self).to receive(:target_in_inventory?).and_return(true)
160
170
  expect(self).to receive(:upload_file).with(local, remote, 'some.host', options: {}, config: nil, inventory: inventory_hash).and_return(result_failure)
@@ -176,7 +186,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
176
186
  context 'when running against localhost and no inventory.yaml file' do
177
187
  it 'does bolt_run_script against localhost without error' do
178
188
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'localhost'))
179
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
189
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
180
190
  expect(self).not_to receive(:inventory_hash_from_inventory_file)
181
191
  expect(self).to receive(:target_in_inventory?).and_return(true)
182
192
  expect(self).to receive(:run_script).with(script, 'litmus_localhost', [], options: {}, config: nil, inventory: localhost_inventory_hash).and_return(result)
@@ -187,7 +197,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
187
197
  context 'when running against remote host' do
188
198
  it 'does bolt_run_script against remote host without error' do
189
199
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
190
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
200
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
191
201
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
192
202
  expect(self).to receive(:target_in_inventory?).and_return(true)
193
203
  expect(self).to receive(:run_script).with(script, 'some.host', [], options: {}, config: nil, inventory: inventory_hash).and_return(result)
@@ -198,7 +208,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
198
208
  context 'when running with arguments' do
199
209
  it 'does bolt_run_script with arguments without error' do
200
210
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'localhost'))
201
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(false)
211
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(false)
202
212
  expect(self).not_to receive(:inventory_hash_from_inventory_file)
203
213
  expect(self).to receive(:target_in_inventory?).and_return(true)
204
214
  expect(self).to receive(:run_script).with(script, 'litmus_localhost', ['doot'], options: {}, config: nil, inventory: localhost_inventory_hash).and_return(result)
@@ -225,7 +235,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
225
235
  context 'when bolt returns success' do
226
236
  it 'does bolt_task_run gives no runtime error for success' do
227
237
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
228
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
238
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
229
239
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
230
240
  expect(self).to receive(:target_in_inventory?).and_return(true)
231
241
  expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_unstructured_task_success)
@@ -243,7 +253,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
243
253
 
244
254
  it 'returns stdout for unstructured-data tasks' do
245
255
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
246
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
256
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
247
257
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
248
258
  expect(self).to receive(:target_in_inventory?).and_return(true)
249
259
  expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_unstructured_task_success)
@@ -253,7 +263,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
253
263
 
254
264
  it 'returns structured output for structured-data tasks' do
255
265
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
256
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
266
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
257
267
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
258
268
  expect(self).to receive(:target_in_inventory?).and_return(true)
259
269
  expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_structured_task_success)
@@ -267,7 +277,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
267
277
  context 'when bolt returns failure' do
268
278
  it 'does bolt_task_run gives runtime error for failure' do
269
279
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
270
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
280
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
271
281
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
272
282
  expect(self).to receive(:target_in_inventory?).and_return(true)
273
283
  expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_failure)
@@ -276,7 +286,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
276
286
 
277
287
  it 'returns the exit code and error message when expecting failure' do
278
288
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
279
- expect(File).to receive(:exist?).with('inventory.yaml').and_return(true)
289
+ expect(File).to receive(:exist?).with('spec/fixtures/litmus_inventory.yaml').and_return(true)
280
290
  expect(self).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
281
291
  expect(self).to receive(:target_in_inventory?).and_return(true)
282
292
  expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_failure)
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: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-19 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -196,7 +196,7 @@ homepage: https://github.com/puppetlabs/puppet_litmus
196
196
  licenses:
197
197
  - Apache-2.0
198
198
  metadata: {}
199
- post_install_message:
199
+ post_install_message:
200
200
  rdoc_options: []
201
201
  require_paths:
202
202
  - lib
@@ -211,8 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
- rubygems_version: 3.1.4
215
- signing_key:
214
+ rubygems_version: 3.0.3
215
+ signing_key:
216
216
  specification_version: 4
217
217
  summary: Providing a simple command line tool for puppet content creators, to enable
218
218
  simple and complex test deployments.