simp-beaker-helpers 1.19.3 → 1.19.4

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: 9eede146380997a5256ef8fc379350b7b2b44e5a4a1156e5a14f13a5be0d396d
4
- data.tar.gz: 31345b9736832c517f96e327dd18ddaca39c9eb72b0d94b9b56e83344f83d645
3
+ metadata.gz: 0a44635bd8cc4cc1a091769b42837b03e7711e280ce4e81a261614ff95ca0241
4
+ data.tar.gz: afbf39be4623d4abb203efcf4215d931cba9366ee1252658918d382d5e6191fd
5
5
  SHA512:
6
- metadata.gz: 89e30957c049a514d97f58e99f2668682fa956e7a43a7414e69dff18d58f9af2f7ac2bf715ba72af97ffe6cdf93630dc3eeb68a45096b07adad069a907abaa93
7
- data.tar.gz: 004cf046d60282beeecc534f39b45d4398cf4b35bccc0b9e46a6cdddf260cd2fd222ebb796e66e10f6cd9e518b7b806584716ccc0eb8734ff2c00181a3a53748
6
+ metadata.gz: e2e6e7bf750cb1b75240583efa6ae766981fe82be3fcfa59e498198285c97901569fd4a17857328497b54c55fbc098504883b1be9b5239db2809ba8a3c80ed90
7
+ data.tar.gz: 20ad194cabcf61d8489efb238ff5d9590c76c3d6e2ea850431d2a51b7295720bf75a8deb48b752c942e0fe0ca8322e5591cf5b2718d69c6a88d923165661c65c
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .fips_fixtures.yml
1
2
  *.gem
2
3
  *.swp
3
4
  Gemfile.lock
@@ -97,28 +97,25 @@ variables:
97
97
  changes:
98
98
  - .gitlab-ci.yml
99
99
  - .fixtures.yml
100
+ - .rspec
101
+ - metadata.json
100
102
  - "spec/spec_helper.rb"
101
- - "spec/{classes,unit,defines,type_aliases,types,hosts}/**/*.rb"
102
- - "{manifests,files,types}/**/*"
103
- - "templates/*.{erb,epp}"
104
- - "lib/**/*"
103
+ - "spec/{classes,unit,defines,type_aliases,types,hosts,lib}/**/*.rb"
104
+ - "{SIMP,data,manifests,files,types,lib}/**/*"
105
+ - "templates/**/*.{erb,epp}"
105
106
  - "Gemfile"
106
- - "SIMP/**/*"
107
- - "data/**/*"
108
107
  exists:
109
- - "spec/{classes,unit,defines,type_aliases,types,hosts}/**/*_spec.rb"
108
+ - "spec/{classes,unit,defines,type_aliases,types,hosts,lib}/**/*_spec.rb"
110
109
 
111
110
  .relevant_file_conditions_trigger_acceptance_tests: &relevant_file_conditions_trigger_acceptance_tests
112
111
  changes:
113
112
  - .gitlab-ci.yml
113
+ - .fixtures.yml
114
114
  - "spec/spec_helper_acceptance.rb"
115
115
  - "spec/acceptance/**/*"
116
- - "{manifests,files,types}/**/*"
117
- - "templates/*.{erb,epp}"
118
- - "lib/**/*"
116
+ - "{SIMP,data,manifests,files,types,lib}/**/*"
117
+ - "templates/**/*.{erb,epp}"
119
118
  - "Gemfile"
120
- - "SIMP/**/*"
121
- - "data/**/*"
122
119
  exists:
123
120
  - "spec/acceptance/**/*_spec.rb"
124
121
 
@@ -286,21 +283,14 @@ variables:
286
283
  pup5-unit:
287
284
  <<: *pup_5
288
285
  <<: *unit_tests
289
- <<: *with_SIMP_SPEC_MATRIX_LEVEL_2
290
286
 
291
287
  pup6-unit:
292
288
  <<: *pup_6
293
289
  <<: *unit_tests
294
- <<: *with_SIMP_SPEC_MATRIX_LEVEL_2
295
-
296
- pup6.18.0-unit:
297
- <<: *pup_6_18_0
298
- <<: *unit_tests
299
290
 
300
291
  pup7-unit:
301
292
  <<: *pup_7
302
293
  <<: *unit_tests
303
- <<: *with_SIMP_SPEC_MATRIX_LEVEL_2
304
294
 
305
295
  # ------------------------------------------------------------------------------
306
296
  # NOTICE: **This file is maintained with puppetsync**
@@ -312,6 +302,26 @@ pup7-unit:
312
302
  # Repo-specific content
313
303
  # ==============================================================================
314
304
 
305
+ #=======================================================================
306
+ # Packaging test
307
+
308
+ pup5-pkg:
309
+ <<: *pup_5
310
+ <<: *unit_tests
311
+ script:
312
+ 'bundle exec rake pkg:gem'
313
+
314
+ pup6-pkg:
315
+ <<: *pup_6
316
+ <<: *unit_tests
317
+ script:
318
+ 'bundle exec rake pkg:gem'
319
+
320
+ pup7-pkg:
321
+ <<: *pup_7
322
+ <<: *unit_tests
323
+ script:
324
+ 'bundle exec rake pkg:gem'
315
325
 
316
326
  #=======================================================================
317
327
  # Acceptance tests
@@ -1,3 +1,12 @@
1
+ ### 1.19.4 / 2021-01-05
2
+ * Fixed:
3
+ * Only return a default empty string when `pfact_on` finds a `nil` value
4
+ * Added an acceptance test to validate this
5
+ * Ensure that we start with `facter -p` for `facter` < 4.0 and continue to
6
+ `puppet facts` otherwise
7
+ * Updated the Rakefile to skip symlinks in chmods which fixes the ability to
8
+ build gems
9
+
1
10
  ### 1.19.3 / 2021-01-01
2
11
  * Fixed:
3
12
  * Ensure that `pfact_on` can handle fact dot notation
data/Rakefile CHANGED
@@ -30,7 +30,7 @@ task :chmod do
30
30
  gemspec = File.expand_path( "#{@package}.gemspec", @rakefile_dir ).strip
31
31
  spec = Gem::Specification::load( gemspec )
32
32
  spec.files.each do |file|
33
- FileUtils.chmod 'go=r', file
33
+ FileUtils.chmod 'go=r', file unless File.symlink?(file)
34
34
  end
35
35
  end
36
36
 
@@ -118,12 +118,31 @@ module Simp::BeakerHelpers
118
118
  def pfact_on(sut, fact_name)
119
119
  require 'ostruct'
120
120
 
121
+ # If puppet is not installed, there are no puppet facts to fetch
121
122
  if sut.which('puppet').empty?
122
123
  fact_on(sut, fact_name, :silent => true)
123
124
  else
124
- facts_json = on(sut,'puppet facts find garbage_xxx', :silent => true).stdout
125
- facts = JSON.parse(facts_json, object_class: OpenStruct).values
126
- facts.dig(*(fact_name.split('.'))) || ''
125
+ facts_json = nil
126
+ begin
127
+ cmd_output = on(sut, 'facter -p --json', :silent => true)
128
+
129
+ # Facter 4+
130
+ raise('skip facter -p') if (cmd_output.stderr =~ /no longer supported/)
131
+
132
+ facts = JSON.parse(cmd_output.stdout, object_class: OpenStruct)
133
+ rescue StandardError
134
+ # If *anything* fails, we need to fall back to `puppet facts`
135
+
136
+ facts_json = on(sut, 'puppet facts find garbage_xxx', :silent => true).stdout
137
+ facts = JSON.parse(facts_json, object_class: OpenStruct).values
138
+ end
139
+
140
+ found_fact = facts.dig(*(fact_name.split('.')))
141
+
142
+ # Fall back to the behavior in fact_on
143
+ found_fact = '' if found_fact.nil?
144
+
145
+ return found_fact
127
146
  end
128
147
  end
129
148
 
@@ -1,5 +1,5 @@
1
1
  module Simp; end
2
2
 
3
3
  module Simp::BeakerHelpers
4
- VERSION = '1.19.3'
4
+ VERSION = '1.19.4'
5
5
  end
@@ -29,4 +29,12 @@ context 'after copy_fixture_modules_to( hosts )' do
29
29
  expect(pfact_on(master, 'os.release.foo')).to eq ''
30
30
  end
31
31
  end
32
+
33
+ describe "pfact_on(master,'fips_enabled')" do
34
+ expected = (ENV['BEAKER_fips'] == 'yes')
35
+
36
+ it 'should return false' do
37
+ expect(pfact_on(master, 'fips_enabled')).to eq expected
38
+ end
39
+ end
32
40
  end
@@ -0,0 +1 @@
1
+ ../../nodesets
@@ -0,0 +1 @@
1
+ ../../nodesets
@@ -103,8 +103,21 @@ describe 'Simp::BeakerHelpers' do
103
103
  end
104
104
 
105
105
  it 'uses defaults when no environment variables are set' do
106
- expect( @helper.get_puppet_install_info[:puppet_install_version] ).to match(/^6\./)
107
- expect( @helper.get_puppet_install_info[:puppet_collection] ).to eq('puppet6')
106
+
107
+ # Prevent namespace pollution
108
+ pipe_out,pipe_in = IO.pipe
109
+ fork do
110
+ pipe_out.close
111
+ require 'puppet'
112
+ pipe_in.write(Puppet.version)
113
+ end
114
+ pipe_in.close
115
+
116
+ expected_version = pipe_out.gets
117
+ expected_major_version = expected_version.split('.').first
118
+
119
+ expect( @helper.get_puppet_install_info[:puppet_install_version] ).to match(expected_version)
120
+ expect( @helper.get_puppet_install_info[:puppet_collection] ).to eq("puppet#{expected_major_version}")
108
121
  expect( @helper.get_puppet_install_info[:puppet_install_type] ).to eq('agent')
109
122
  end
110
123
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-beaker-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.3
4
+ version: 1.19.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tessmer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-04 00:00:00.000000000 Z
12
+ date: 2021-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: beaker
@@ -192,11 +192,13 @@ files:
192
192
  - spec/acceptance/suites/default/enable_fips_spec.rb
193
193
  - spec/acceptance/suites/default/fixture_modules_spec.rb
194
194
  - spec/acceptance/suites/default/install_simp_deps_repo_spec.rb
195
+ - spec/acceptance/suites/default/nodesets
195
196
  - spec/acceptance/suites/default/pki_tests_spec.rb
196
197
  - spec/acceptance/suites/default/set_hieradata_on_spec.rb
197
198
  - spec/acceptance/suites/default/write_hieradata_to_spec.rb
198
199
  - spec/acceptance/suites/fips_from_fixtures/00_default_spec.rb
199
200
  - spec/acceptance/suites/fips_from_fixtures/metadata.yml
201
+ - spec/acceptance/suites/fips_from_fixtures/nodesets
200
202
  - spec/acceptance/suites/offline/00_default_spec.rb
201
203
  - spec/acceptance/suites/offline/README
202
204
  - spec/acceptance/suites/offline/nodesets/default.yml
@@ -204,6 +206,7 @@ files:
204
206
  - spec/acceptance/suites/puppet_collections/metadata.yml
205
207
  - spec/acceptance/suites/snapshot/00_snapshot_test_spec.rb
206
208
  - spec/acceptance/suites/snapshot/10_general_usage_spec.rb
209
+ - spec/acceptance/suites/snapshot/nodesets
207
210
  - spec/acceptance/suites/windows/00_default_spec.rb
208
211
  - spec/acceptance/suites/windows/metadata.yml
209
212
  - spec/acceptance/suites/windows/nodesets/default.yml
@@ -242,11 +245,13 @@ test_files:
242
245
  - spec/acceptance/suites/default/enable_fips_spec.rb
243
246
  - spec/acceptance/suites/default/fixture_modules_spec.rb
244
247
  - spec/acceptance/suites/default/install_simp_deps_repo_spec.rb
248
+ - spec/acceptance/suites/default/nodesets
245
249
  - spec/acceptance/suites/default/pki_tests_spec.rb
246
250
  - spec/acceptance/suites/default/set_hieradata_on_spec.rb
247
251
  - spec/acceptance/suites/default/write_hieradata_to_spec.rb
248
252
  - spec/acceptance/suites/fips_from_fixtures/00_default_spec.rb
249
253
  - spec/acceptance/suites/fips_from_fixtures/metadata.yml
254
+ - spec/acceptance/suites/fips_from_fixtures/nodesets
250
255
  - spec/acceptance/suites/offline/00_default_spec.rb
251
256
  - spec/acceptance/suites/offline/README
252
257
  - spec/acceptance/suites/offline/nodesets/default.yml
@@ -254,6 +259,7 @@ test_files:
254
259
  - spec/acceptance/suites/puppet_collections/metadata.yml
255
260
  - spec/acceptance/suites/snapshot/00_snapshot_test_spec.rb
256
261
  - spec/acceptance/suites/snapshot/10_general_usage_spec.rb
262
+ - spec/acceptance/suites/snapshot/nodesets
257
263
  - spec/acceptance/suites/windows/00_default_spec.rb
258
264
  - spec/acceptance/suites/windows/metadata.yml
259
265
  - spec/acceptance/suites/windows/nodesets/default.yml