simp-beaker-helpers 1.24.2 → 1.25.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: a3ebfb21a6409e25775b605532f96982fe2bfc200dced0a88683427bf1c3818e
4
- data.tar.gz: 94ecd0803ebda28858480211e6fc0d0ab0402c96dbf3101fa4f6a7f17070c11e
3
+ metadata.gz: bce7304da1a7425de25af167725291b8889ca26e1bbbed5559b0583fb900a1b4
4
+ data.tar.gz: 359b9c5c9eda2855e7eab95f1afc7837f3fbc108ccef4aaf2eb6d2b0d9f7858f
5
5
  SHA512:
6
- metadata.gz: 72fb511dc7fb090c5ae5f80170975af6c0e33ebf01744b090a1cae8579e052d8baa354b9d42e9b9a9b50fda12afc54e8e519e1278bc565633b8777be79827c18
7
- data.tar.gz: 4629b633ec4a047d1549fa9f7ab2dbc457a72e1770cfbff8aaf9eba9a5648905a9be87b32a5191797caab501e25e47ba6cb975e70a1ebc9ca9b0bd16f34201de
6
+ metadata.gz: 9ea99cff5b4a6e7e0f7fe1720efe7e439215ea14cbc0f278fe7a0f314470a3026fe64717d55559e1c80945ac4cb28289f25344b5e5e7a978516d11029b1f1add
7
+ data.tar.gz: 336a178662a391759629d6d539aaf78b3ecb7d7fc93804e49e63bf03057cb87a6d9f996298c8a203a31e4aec4ee299df8dd49ba68e950df216769553edf4d2f7
@@ -1,4 +1,4 @@
1
- # When SemVer tag is pushed: create GitHub release & publish gem to rubygems.org
1
+ # Create GitHub release, build & publish .gem to rubygems.org on SemVer tag push
2
2
  #
3
3
  # This workflow's jobs are only triggered in repos under the `simp` organization
4
4
  # ------------------------------------------------------------------------------
@@ -21,7 +21,7 @@
21
21
  #
22
22
  # NOTES:
23
23
  #
24
- # * The CHANGLOG text is altered to remove RPM-style date headers, which don't
24
+ # * The CHANGELOG text is altered to remove RPM-style date headers, which don't
25
25
  # render well as markdown on the GitHub release pages
26
26
  #
27
27
  # * By default, the gem is built and released using the standard rake tasks
@@ -37,12 +37,15 @@
37
37
  # All keys are optional.
38
38
  #
39
39
  ---
40
- name: 'Tag: Release to GitHub & rubygems.org'
40
+ name: 'Tag: Release to GitHub + rubygems.org (no RPMS)'
41
41
 
42
42
  on:
43
43
  push:
44
44
  tags:
45
+ # NOTE: These filter patterns aren't actually regexes:
46
+ # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
45
47
  - '[0-9]+\.[0-9]+\.[0-9]+'
48
+ - '[0-9]+\.[0-9]+\.[0-9]+\-[a-z]+[0-9]+'
46
49
 
47
50
  env:
48
51
  PUPPET_VERSION: '~> 6'
@@ -52,7 +55,7 @@ jobs:
52
55
  releng-checks:
53
56
  name: "RELENG checks"
54
57
  if: github.repository_owner == 'simp'
55
- runs-on: ubuntu-18.04
58
+ runs-on: ubuntu-latest
56
59
  outputs:
57
60
  build_command: ${{ steps.commands.outputs.build_command }}
58
61
  release_command: ${{ steps.commands.outputs.release_command }}
@@ -64,11 +67,11 @@ jobs:
64
67
  with:
65
68
  ref: ${{ github.ref }}
66
69
  clean: true
67
- - name: Determing build and release commands
70
+ - name: Determine build and release commands
68
71
  id: commands
69
72
  run: |
70
- # By default, these are the standard tasks from "bundler/gem_tasks"
71
- # To override them in the LOCAL_WORKFLOW_CONFIG_FILE
73
+ # By default, this is the standard task from "bundler/gem_tasks"
74
+ # To override it, add the new command to LOCAL_WORKFLOW_CONFIG_FILE
72
75
  GEM_BUILD_COMMAND='bundle exec rake build'
73
76
  GEM_RELEASE_COMMAND='bundle exec rake build release:rubygem_push'
74
77
  GEM_PKG_DIR='pkg'
@@ -92,9 +95,7 @@ jobs:
92
95
  ruby-version: 2.5
93
96
  bundler-cache: true
94
97
  - name: Test build the package
95
- env:
96
- GEM_BUILD_COMMAND: ${{ steps.commands.outputs.build_command }}
97
- run: "$GEM_BUILD_COMMAND"
98
+ run: "${{ steps.commands.outputs.build_command }}"
98
99
  - name: "Assert '${{ github.ref }}' matches the package version"
99
100
  run: |
100
101
  tag="${GITHUB_REF/refs\/tags\//}"
@@ -109,7 +110,9 @@ jobs:
109
110
  name: Deploy GitHub Release
110
111
  needs: [ releng-checks ]
111
112
  if: github.repository_owner == 'simp'
112
- runs-on: ubuntu-18.04
113
+ runs-on: ubuntu-latest
114
+ outputs:
115
+ prerelease: ${{ steps.tag-check.outputs.prerelease }}
113
116
  steps:
114
117
  - name: Checkout code
115
118
  uses: actions/checkout@v2
@@ -117,6 +120,7 @@ jobs:
117
120
  ref: ${{ github.ref }}
118
121
  clean: true
119
122
  fetch-depth: 0
123
+
120
124
  - name: Get tag & annotation info (${{github.ref}})
121
125
  id: tag-check
122
126
  run: |
@@ -124,7 +128,19 @@ jobs:
124
128
  annotation="$(git for-each-ref "$GITHUB_REF" --format='%(contents)' --count=1)"
125
129
  annotation_title="$(echo "$annotation" | head -1)"
126
130
 
131
+
132
+ if [[ "$tag" =~ ^(simp-|v)?[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta|pre|post)?([0-9]+)?)?$ ]]; then
133
+ if [ -n "${BASH_REMATCH[2]}" ]; then
134
+ prerelease=yes
135
+ annotation_title="Pre-release of ${tag}"
136
+ fi
137
+ else
138
+ printf '::error ::Release Tag format is not SemVer, X.Y.Z-R, X.Y.Z-<prerelease>: "%s"\n' "$RELEASE_TAG"
139
+ exit 88
140
+ fi
141
+
127
142
  echo "::set-output name=tag::${tag}"
143
+ echo "::set-output name=prerelease::${prerelease}"
128
144
  echo "::set-output name=annotation_title::${annotation_title}"
129
145
 
130
146
  # Prepare annotation body as a file for the next step
@@ -146,14 +162,14 @@ jobs:
146
162
  tag_name: ${{ github.ref }}
147
163
  release_name: ${{ steps.tag-check.outputs.annotation_title }}
148
164
  body_path: /tmp/annotation.body
165
+ prerelease: ${{ steps.tag-check.outputs.prerelease == 'yes'}}
149
166
  draft: false
150
- prerelease: false
151
167
 
152
168
  deploy-rubygem:
153
169
  name: Deploy RubyGem Release
154
- needs: [ releng-checks ]
155
- if: github.repository_owner == 'simp'
156
- runs-on: ubuntu-18.04
170
+ needs: [ releng-checks, create-github-release ]
171
+ if: (github.repository_owner == 'simp') && (needs.create-github-release.outputs.prerelease != 'yes')
172
+ runs-on: ubuntu-latest
157
173
  env:
158
174
  RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
159
175
  BUILD_COMMAND: ${{ needs.releng-checks.outputs.build_command }}
data/.gitignore CHANGED
@@ -1,9 +1,24 @@
1
+ .*.sw?
2
+ .yardoc
3
+ .idea/
1
4
  .fips_fixtures.yml
2
5
  *.gem
3
- *.swp
4
- Gemfile.lock
5
- .bundle/
6
6
  *.old
7
7
  .vagrant
8
+ dist
9
+ /pkg
10
+ # Read everything in fixtures
11
+ /spec/fixtures/*
12
+ # Un-ignore hieradata
13
+ !/spec/fixtures/hieradata/*
14
+ # Except this one, which is auto-generated
15
+ /spec/fixtures/hieradata/hiera.yaml
16
+ /spec/rp_env
17
+ /.rspec_system
18
+ /.vagrant
19
+ /.bundle
20
+ /.vendor
21
+ /vendor
22
+ /junit
8
23
  /log
9
- /spec/fixtures
24
+ /doc
data/.gitlab-ci.yml CHANGED
@@ -209,13 +209,6 @@ variables:
209
209
  # Puppet Versions
210
210
  #-----------------------------------------------------------------------
211
211
 
212
- .pup_5_x: &pup_5_x
213
- image: 'ruby:2.4'
214
- variables:
215
- PUPPET_VERSION: '~> 5.0'
216
- BEAKER_PUPPET_COLLECTION: 'puppet5'
217
- MATRIX_RUBY_VERSION: '2.4'
218
-
219
212
  .pup_6_x: &pup_6_x
220
213
  image: 'ruby:2.5'
221
214
  variables:
@@ -320,6 +313,12 @@ default:
320
313
  script:
321
314
  - bundle exec rake beaker:suites[default]
322
315
 
316
+ default-amzn2:
317
+ <<: *pup_6_x
318
+ <<: *acceptance_base
319
+ script:
320
+ - bundle exec rake beaker:suites[default,amzn2]
321
+
323
322
  default-fips:
324
323
  <<: *pup_6_x
325
324
  <<: *acceptance_base
@@ -332,12 +331,6 @@ fips_from_fixtures:
332
331
  script:
333
332
  - bundle exec rake beaker:suites[fips_from_fixtures]
334
333
 
335
- puppet5_collections:
336
- <<: *pup_5_x
337
- <<: *acceptance_base
338
- script:
339
- - bundle exec rake beaker:suites[puppet_collections]
340
-
341
334
  puppet6_collections:
342
335
  <<: *pup_6_x
343
336
  <<: *acceptance_base
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ ### 1.25.0 / 2022-06-11
2
+ * Fixed:
3
+ * Replaced calls to `sed -c` with something POSIX compliant that should work
4
+ on non-RHEL systems
5
+ * Added:
6
+ * Updated all dependencies to their latest versions where possible and removed
7
+ depdendencies on deprecated libraries.
8
+
9
+ ### 1.24.5 / 2022-05-06
10
+ * Fixed:
11
+ * Added a workaround for Amazon Linux 2 testing
12
+
13
+ ### 1.24.4 / 2022-04-28
14
+ * Fixed:
15
+ * Workaround for [MODULES-11315] in `puppet-agent-versions.yaml`
16
+ * Removed:
17
+ * Dropped acceptance tests for Puppet 5.5
18
+
19
+ [MODULES-11315]: https://tickets.puppetlabs.com/browse/MODULES-11315
20
+
21
+ ### 1.24.3 / 2022-04-10
22
+ * Fixed:
23
+ * Added python-setuptools to the list of required packages
24
+
1
25
  ### 1.24.2 / 2022-03-09
2
26
  * Fixed:
3
27
  * Prevent `spec/` directory symlink recursion in `copy_fixture_modules_to`
data/Gemfile CHANGED
@@ -44,8 +44,8 @@ group :system_tests do
44
44
  gem 'beaker-rspec'
45
45
  gem 'beaker-windows'
46
46
  gem 'net-ssh'
47
- gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 6.0')
48
- gem 'puppetlabs_spec_helper', '~> 3.0'
47
+ gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 7.0')
49
48
  gem 'rubocop'
50
49
  gem 'rubocop-rspec'
50
+ gem 'puppetlabs_spec_helper', '~> 4.0'
51
51
  end
data/files/pki/make.sh CHANGED
@@ -73,7 +73,8 @@ for hosts in $*; do
73
73
  done
74
74
  done
75
75
 
76
- sed -ci "s/# subjectAltName = #ALTNAMES#/subjectAltName = ${altnames}/" "working/${hname}.cnf"
76
+ tgt_file="working/${hname}.cnf"
77
+ sed -e "s/# subjectAltName = #ALTNAMES#/subjectAltName = ${altnames}/" "$tgt_file" 1<> "$tgt_file"
77
78
  fi
78
79
 
79
80
  echo "-- running openssl req"
@@ -44,3 +44,4 @@ version_mappings:
44
44
  '4.2.0': '1.2.1'
45
45
  '4.1.0': '1.1.1'
46
46
  '4.0.0': '1.0.1'
47
+ '6.27.0': '6.27.1' # latest gem is 6.7.0, only RPM is 6.7.1
@@ -23,11 +23,12 @@ module Simp::BeakerHelpers
23
23
  'PyYAML',
24
24
  'cmake',
25
25
  'git',
26
- 'openscap-scanner',
27
26
  'openscap-python',
27
+ 'openscap-scanner',
28
28
  'openscap-utils',
29
29
  'python-jinja2',
30
- 'python-lxml'
30
+ 'python-lxml',
31
+ 'python-setuptools'
31
32
  ]
32
33
 
33
34
  EL8_PACKAGES = [
@@ -41,6 +42,7 @@ module Simp::BeakerHelpers
41
42
  'python3-jinja2',
42
43
  'python3-lxml',
43
44
  'python3-pyyaml',
45
+ 'python3-setuptools',
44
46
  'libarchive'
45
47
  ]
46
48
 
@@ -418,7 +420,11 @@ module Simp::BeakerHelpers
418
420
  #
419
421
  # This isn't 100% correct but it's "good enough" for an automated CI
420
422
  # environment to tell us if something is critically out of alignment.
421
- on(@sut, %(cd scap-content/build-scripts; sed -ci 's/ssg.build_derivatives.profile_handling/__simp_dontcare__ = None #ssg.build_derivatives.profile_handling/g' enable_derivatives.py))
423
+ safe_sed(
424
+ @sut,
425
+ 's/ssg.build_derivatives.profile_handling/__simp_dontcare__ = None #ssg.build_derivatives.profile_handling/g',
426
+ 'scap-content/build-scripts/enable_derivatives.py'
427
+ )
422
428
 
423
429
  on(@sut, %(cd scap-content/build; cmake ../; make -j4 #{OS_INFO[@os][@os_rel]['ssg']['build_target']}-content && cp *ds.xml #{@scap_working_dir}))
424
430
  end
@@ -1,5 +1,5 @@
1
1
  module Simp; end
2
2
 
3
3
  module Simp::BeakerHelpers
4
- VERSION = '1.24.2'
4
+ VERSION = '1.25.0'
5
5
  end
@@ -12,6 +12,8 @@ module Simp::BeakerHelpers
12
12
  require 'simp/beaker_helpers/ssg'
13
13
  require 'simp/beaker_helpers/version'
14
14
 
15
+ @run_in_parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
16
+
15
17
  # Stealing this from the Ruby 2.5 Dir::Tmpname workaround from Rails
16
18
  def self.tmpname
17
19
  t = Time.new.strftime("%Y%m%d")
@@ -25,8 +27,7 @@ module Simp::BeakerHelpers
25
27
  #
26
28
  # Has no effect if yum or dnf is not present.
27
29
  def set_yum_opt_on(suts, key, value)
28
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
29
- block_on(suts, :run_in_parallel => parallel) do |sut|
30
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
30
31
  repo,target = key.split('.')
31
32
 
32
33
  unless target
@@ -56,8 +57,7 @@ module Simp::BeakerHelpers
56
57
  # 'foo.installonly_limit' => '5' # Applies only to the 'foo' repo
57
58
  # }
58
59
  def set_yum_opts_on(suts, yum_opts={})
59
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
60
- block_on(suts, :run_in_parallel => parallel) do |sut|
60
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
61
61
  yum_opts.each_pair do |k,v|
62
62
  set_yum_opt_on(sut, k, v)
63
63
  end
@@ -70,8 +70,7 @@ module Simp::BeakerHelpers
70
70
  retry_interval: 10
71
71
  }
72
72
 
73
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
74
- block_on(suts, :run_in_parallel => parallel) do |sut|
73
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
75
74
  package_source = package_name unless package_source
76
75
 
77
76
  unless sut.check_for_package(package_name)
@@ -91,8 +90,7 @@ module Simp::BeakerHelpers
91
90
  retry_interval: 10
92
91
  }
93
92
 
94
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
95
- block_on(suts, :run_in_parallel => parallel) do |sut|
93
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
96
94
  package_source = package_name unless package_source
97
95
 
98
96
  if sut.check_for_package(package_name)
@@ -380,8 +378,7 @@ module Simp::BeakerHelpers
380
378
  opts[:pluginsync] = opts.fetch(:pluginsync, true)
381
379
 
382
380
  unless ENV['BEAKER_copy_fixtures'] == 'no'
383
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
384
- block_on(suts, :run_in_parallel => parallel) do |sut|
381
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
385
382
  STDERR.puts " ** copy_fixture_modules_to: '#{sut}'" if ENV['BEAKER_helpers_verbose']
386
383
 
387
384
  # Use spec_prep to provide modules (this supports isolated networks)
@@ -443,8 +440,7 @@ module Simp::BeakerHelpers
443
440
  end
444
441
 
445
442
  def munge_ssh_crypto_policies(suts, key_types=['ssh-rsa'])
446
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
447
- block_on(suts, :run_in_parallel => parallel) do |sut|
443
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
448
444
  if has_crypto_policies(sut)
449
445
  install_latest_package_on(sut, 'crypto-policies', nil, :accept_all_exit_codes => true)
450
446
 
@@ -455,14 +451,31 @@ module Simp::BeakerHelpers
455
451
  end
456
452
  end
457
453
 
454
+ # Perform the equivalend of an in-place sed without changing the target inode
455
+ #
456
+ # Required for many container targets
457
+ def safe_sed(suts = hosts, pattern, target_file)
458
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
459
+ tmpfile = sut.tmpfile('safe_sed')
460
+
461
+ command = [
462
+ "cp #{target_file} #{tmpfile}",
463
+ "sed -i '#{pattern}' #{tmpfile}",
464
+ "cat #{tmpfile} > #{target_file}"
465
+ ].join(' && ')
466
+
467
+ on(sut, command)
468
+
469
+ sut.rm_rf(tmpfile)
470
+ end
471
+ end
472
+
458
473
  # Configure and reboot SUTs into FIPS mode
459
474
  def enable_fips_mode_on( suts = hosts )
460
475
  puts '== configuring FIPS mode on SUTs'
461
476
  puts ' -- (use BEAKER_fips=no to disable)'
462
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
463
477
 
464
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
465
- block_on(suts, :run_in_parallel => parallel) do |sut|
478
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
466
479
  next if sut[:hypervisor] == 'docker'
467
480
 
468
481
  if is_windows?(sut)
@@ -483,7 +496,7 @@ module Simp::BeakerHelpers
483
496
  # that doesn't break vagrant access and is appropriate for
484
497
  # typical module tests.)
485
498
  fips_ssh_ciphers = [ 'aes256-ctr','aes192-ctr','aes128-ctr']
486
- on(sut, %(sed -ci '/Ciphers /d' /etc/ssh/sshd_config))
499
+ safe_sed(sut, '/Ciphers /d', '/etc/ssh/sshd_config')
487
500
  on(sut, %(echo 'Ciphers #{fips_ssh_ciphers.join(',')}' >> /etc/ssh/sshd_config))
488
501
 
489
502
  fips_enable_modulepath = ''
@@ -535,8 +548,7 @@ module Simp::BeakerHelpers
535
548
  # - <URL to GPGKEY1>
536
549
  # - <URL to GPGKEY2>
537
550
  def enable_yum_repos_on( suts = hosts )
538
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
539
- block_on(suts, :run_in_parallel => parallel) do |sut|
551
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
540
552
  if sut['yum_repos']
541
553
  sut['yum_repos'].each_pair do |repo, metadata|
542
554
  repo_manifest = create_yum_resource(repo, metadata)
@@ -617,8 +629,7 @@ module Simp::BeakerHelpers
617
629
  #
618
630
  # Can be disabled by setting BEAKER_enable_epel=no
619
631
  def enable_epel_on(suts)
620
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
621
- block_on(suts, :run_in_parallel => parallel) do |sut|
632
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
622
633
  if ONLINE
623
634
  os_info = fact_on(sut, 'os')
624
635
  os_maj_rel = os_info['release']['major']
@@ -661,8 +672,7 @@ module Simp::BeakerHelpers
661
672
  end
662
673
 
663
674
  def update_package_from_centos_stream(suts, package_name)
664
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
665
- block_on(suts, :run_in_parallel => parallel) do |sut|
675
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
666
676
  sut.install_package('centos-release-stream') unless sut.check_for_package('centos-release-stream')
667
677
  install_latest_package_on(sut, package_name)
668
678
  sut.uninstall_package('centos-release-stream')
@@ -670,8 +680,7 @@ module Simp::BeakerHelpers
670
680
  end
671
681
 
672
682
  def linux_errata( suts )
673
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
674
- block_on(suts, :run_in_parallel => parallel) do |sut|
683
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
675
684
  # Set the locale if not set
676
685
  sut.set_env_var('LANG', 'en_US.UTF-8') unless sut.get_env_var('LANG')
677
686
 
@@ -688,9 +697,14 @@ module Simp::BeakerHelpers
688
697
  if current_domain.empty?
689
698
  new_fqdn = hostname + '.beaker.test'
690
699
 
691
- on(sut, "sed -ci 's/#{hostname}.*/#{new_fqdn} #{hostname}/' /etc/hosts")
692
- on(sut, "echo '#{new_fqdn}' > /etc/hostname", :accept_all_exit_codes => true)
693
- on(sut, "hostname #{new_fqdn}", :accept_all_exit_codes => true)
700
+ safe_sed(sut, 's/#{hostname}.*/#{new_fqdn} #{hostname}/', '/etc/hosts')
701
+
702
+ if !sut.which('hostnamectl').empty?
703
+ on(sut, "hostnamectl set-hostname #{new_fqdn}")
704
+ else
705
+ on(sut, "echo '#{new_fqdn}' > /etc/hostname", :accept_all_exit_codes => true)
706
+ on(sut, "hostname #{new_fqdn}", :accept_all_exit_codes => true)
707
+ end
694
708
 
695
709
  if sut.file_exist?('/etc/sysconfig/network')
696
710
  on(sut, "sed -s '/HOSTNAME=/d' /etc/sysconfig/network")
@@ -785,8 +799,7 @@ module Simp::BeakerHelpers
785
799
  def rhel_rhsm_subscribe(suts, *opts)
786
800
  require 'securerandom'
787
801
 
788
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
789
- block_on(suts, :run_in_parallel => parallel) do |sut|
802
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
790
803
  rhsm_opts = {
791
804
  :username => ENV['BEAKER_RHSM_USER'],
792
805
  :password => ENV['BEAKER_RHSM_PASS'],
@@ -838,8 +851,7 @@ module Simp::BeakerHelpers
838
851
  end
839
852
 
840
853
  def sosreport(suts, dest='sosreports')
841
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
842
- block_on(suts, :run_in_parallel => parallel) do |sut|
854
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
843
855
  install_latest_package_on(sut, 'sos')
844
856
  on(sut, 'sosreport --batch')
845
857
 
@@ -854,8 +866,7 @@ module Simp::BeakerHelpers
854
866
  end
855
867
 
856
868
  def rhel_repo_enable(suts, repos)
857
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
858
- block_on(suts, :run_in_parallel => parallel) do |sut|
869
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
859
870
  Array(repos).each do |repo|
860
871
  on(sut, %{subscription-manager repos --enable #{repo}})
861
872
  end
@@ -863,8 +874,7 @@ module Simp::BeakerHelpers
863
874
  end
864
875
 
865
876
  def rhel_repo_disable(suts, repos)
866
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
867
- block_on(suts, :run_in_parallel => parallel) do |sut|
877
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
868
878
  Array(repos).each do |repo|
869
879
  on(sut, %{subscription-manager repos --disable #{repo}}, :accept_all_exit_codes => true)
870
880
  end
@@ -872,16 +882,14 @@ module Simp::BeakerHelpers
872
882
  end
873
883
 
874
884
  def rhel_rhsm_unsubscribe(suts)
875
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
876
- block_on(suts, :run_in_parallel => parallel) do |sut|
885
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
877
886
  on(sut, %{subscription-manager unregister}, :accept_all_exit_codes => true)
878
887
  end
879
888
  end
880
889
 
881
890
  # Apply known OS fixes we need to run Beaker on each SUT
882
891
  def fix_errata_on( suts = hosts )
883
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
884
- block_on(suts, :run_in_parallel => parallel) do |sut|
892
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
885
893
  if is_windows?(sut)
886
894
  # Load the Windows requirements
887
895
  require 'simp/beaker_helpers/windows'
@@ -1091,8 +1099,7 @@ module Simp::BeakerHelpers
1091
1099
  def activate_interfaces(hosts)
1092
1100
  return if ENV['BEAKER_no_fix_interfaces']
1093
1101
 
1094
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
1095
- block_on(hosts, :run_in_parallel => parallel) do |host|
1102
+ block_on(hosts, :run_in_parallel => @run_in_parallel) do |host|
1096
1103
  if host[:platform] =~ /windows/
1097
1104
  puts " -- SKIPPING #{host} because it is windows"
1098
1105
  next
@@ -1335,8 +1342,7 @@ module Simp::BeakerHelpers
1335
1342
  noop => false
1336
1343
  }
1337
1344
  PLUGINSYNC_MANIFEST
1338
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
1339
- apply_manifest_on(hosts, pluginsync_manifest, :run_in_parallel => parallel)
1345
+ apply_manifest_on(hosts, pluginsync_manifest, :run_in_parallel => @run_in_parallel)
1340
1346
  end
1341
1347
 
1342
1348
 
@@ -1455,9 +1461,8 @@ module Simp::BeakerHelpers
1455
1461
  ENV['BEAKER_PUPPET_COLLECTION'] = install_info[:puppet_collection]
1456
1462
  end
1457
1463
 
1458
- require 'beaker/puppet_install_helper'
1459
-
1460
- run_puppet_install_helper(install_info[:puppet_install_type], install_info[:puppet_install_version])
1464
+ require 'beaker-puppet'
1465
+ install_puppet_on(hosts, version: install_info[:puppet_install_version])
1461
1466
  end
1462
1467
 
1463
1468
  # Configure all SIMP repos on a host and disable all repos in the disable Array
@@ -1494,18 +1499,28 @@ module Simp::BeakerHelpers
1494
1499
 
1495
1500
  return if (ENV.fetch('SIMP_install_repos', 'yes') == 'no')
1496
1501
 
1497
- parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
1498
- block_on(suts, :run_in_parallel => parallel) do |sut|
1502
+ block_on(suts, :run_in_parallel => @run_in_parallel) do |sut|
1499
1503
  install_package_unless_present_on(sut, 'yum-utils')
1500
1504
 
1505
+ os = fact_on(sut, 'os.name')
1501
1506
  release = fact_on(sut, 'os.release.major')
1502
1507
 
1508
+ # Work around Amazon 2 compatibility
1509
+ if (( os == 'Amazon' ) && ( "#{release}" == '2' ))
1510
+ release = '7'
1511
+ end
1512
+
1503
1513
  install_package_unless_present_on(
1504
1514
  sut,
1505
1515
  'simp-release-community',
1506
1516
  "https://download.simp-project.com/simp-release-community.el#{release}.rpm"
1507
1517
  )
1508
1518
 
1519
+ # TODO: Remove this hack-around when there's a version for AL2
1520
+ if ( os == 'Amazon' )
1521
+ on(sut, %(sed -i 's/$releasever/#{release}/g' /etc/yum.repos.d/simp*))
1522
+ end
1523
+
1509
1524
  to_disable = disable.dup
1510
1525
  to_disable += ENV.fetch('BEAKER_SIMP_disable_repos', '').split(',').map(&:strip)
1511
1526
 
@@ -2,7 +2,8 @@ require 'rake'
2
2
  require 'rake/clean'
3
3
  require 'rake/tasklib'
4
4
  require 'fileutils'
5
- require 'puppetlabs_spec_helper/tasks/beaker'
5
+ require 'beaker/tasks/rake_task'
6
+ require 'beaker-rspec/rake_task'
6
7
  require 'puppetlabs_spec_helper/tasks/fixtures'
7
8
 
8
9
  module Simp; end
@@ -22,19 +22,14 @@ Gem::Specification.new do |s|
22
22
  s.required_ruby_version = '>= 2.3.0'
23
23
 
24
24
  s.add_runtime_dependency 'beaker' , ['>= 4.17.0', '< 5.0.0']
25
- s.add_runtime_dependency 'beaker-rspec' , '~> 6.2'
25
+ s.add_runtime_dependency 'beaker-rspec' , '~> 7.1'
26
26
  s.add_runtime_dependency 'beaker-puppet' , ['>= 1.18.14', '< 2.0.0']
27
27
  s.add_runtime_dependency 'beaker-docker' , ['>= 0.8.3', '< 2.0.0']
28
28
  s.add_runtime_dependency 'docker-api' , ['>= 2.1.0', '< 3.0.0']
29
29
  s.add_runtime_dependency 'beaker-vagrant' , ['>= 0.6.4', '< 2.0.0']
30
- s.add_runtime_dependency 'beaker-puppet_install_helper', '~> 0.9'
31
30
  s.add_runtime_dependency 'highline' , '~> 2.0'
32
31
  s.add_runtime_dependency 'nokogiri' , '~> 1.8'
33
32
 
34
- # Because net-telnet dropped support for Ruby < 2.3.0
35
- # TODO: Update this when we no longer support Ruby 2.1.9 (should be October 2018)
36
- s.add_runtime_dependency 'net-telnet', '~> 0.1.1'
37
-
38
33
  ### s.files = Dir['Rakefile', '{bin,lib,spec}/**/*', 'README*', 'LICENSE*'] & `git ls-files -z .`.split("\0")
39
34
  s.files = `git ls-files`.split("\n")
40
35
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -0,0 +1,23 @@
1
+ <%
2
+ if ENV['BEAKER_HYPERVISOR']
3
+ hypervisor = ENV['BEAKER_HYPERVISOR']
4
+ else
5
+ hypervisor = 'vagrant'
6
+ end
7
+ -%>
8
+ HOSTS:
9
+ amzn2:
10
+ roles:
11
+ - master
12
+ - default
13
+ platform: el-7-x86_64
14
+ box: gbailey/amzn2
15
+ hypervisor: <%= hypervisor %>
16
+
17
+ CONFIG:
18
+ log_level: verbose
19
+ synced_folder : disabled
20
+ type: aio
21
+ <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
22
+ puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
23
+ <% end -%>
@@ -18,21 +18,12 @@ HOSTS:
18
18
  roles:
19
19
  - el8
20
20
  platform: el-8-x86_64
21
- box: generic/centos8
22
- hypervisor: <%= hypervisor %>
23
-
24
- el8-0:
25
- roles:
26
- - el8
27
- platform: el-8-x86_64
28
- box: centos/8
29
- box_version: "1905.1"
21
+ box: centos/stream8
30
22
  hypervisor: <%= hypervisor %>
31
23
 
32
24
  CONFIG:
33
25
  log_level: verbose
34
26
  type: aio
35
- vagrant_memsize: 512
36
27
  vagrant_cpus: 2
37
28
  <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
38
29
  puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
@@ -24,7 +24,6 @@ HOSTS:
24
24
  CONFIG:
25
25
  log_level: verbose
26
26
  type: aio
27
- vagrant_memsize: 1024
28
27
  vagrant_cpus: 2
29
28
  <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
30
29
  puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
@@ -14,7 +14,6 @@ HOSTS:
14
14
  CONFIG:
15
15
  log_level: verbose
16
16
  type: aio
17
- vagrant_memsize: 512
18
17
  <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
19
18
  puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
20
19
  <% end -%>
@@ -5,8 +5,6 @@ require 'beaker-rspec'
5
5
  require 'simp/beaker_helpers'
6
6
  include Simp::BeakerHelpers
7
7
 
8
- require 'beaker/puppet_install_helper'
9
-
10
8
  unless ENV['BEAKER_provision'] == 'no'
11
9
  hosts.each do |host|
12
10
  unless Simp::BeakerHelpers::Snapshot.exist?(host, 'puppet_installed')
@@ -29,7 +29,6 @@ HOSTS:
29
29
  CONFIG:
30
30
  log_level: verbose
31
31
  type: aio
32
- vagrant_memsize: 256
33
32
  <% if ENV['BEAKER_PUPPET_ENVIRONMENT'] -%>
34
33
  puppet_environment: <%= ENV['BEAKER_PUPPET_ENVIRONMENT'] %>
35
34
  <% end -%>
@@ -29,7 +29,6 @@ HOSTS:
29
29
  CONFIG:
30
30
  log_level: verbose
31
31
  type: aio
32
- vagrant_memsize: 256
33
32
  <% if ENV['BEAKER_PUPPET_ENVIRONMENT'] -%>
34
33
  puppet_environment: <%= ENV['BEAKER_PUPPET_ENVIRONMENT'] %>
35
34
  <% end -%>
@@ -28,7 +28,6 @@ HOSTS:
28
28
  CONFIG:
29
29
  log_level: verbose
30
30
  type: aio
31
- vagrant_memsize: 256
32
31
  <% if ENV['BEAKER_PUPPET_ENVIRONMENT'] -%>
33
32
  puppet_environment: <%= ENV['BEAKER_PUPPET_ENVIRONMENT'] %>
34
33
  <% end -%>
@@ -18,8 +18,40 @@ end
18
18
 
19
19
  RSpec.configure do |c|
20
20
  # ensure that environment OS is ready on each host
21
- fix_errata_on(hosts)
21
+ fix_errata_on hosts
22
+
23
+ # Detect cases in which no examples are executed (e.g., nodeset does not
24
+ # have hosts with required roles)
25
+ c.fail_if_no_examples = true
22
26
 
23
27
  # Readable test descriptions
24
28
  c.formatter = :documentation
29
+
30
+ # Configure all nodes in nodeset
31
+ c.before :suite do
32
+ begin
33
+ # Install modules and dependencies from spec/fixtures/modules
34
+ copy_fixture_modules_to( hosts )
35
+ begin
36
+ server = only_host_with_role(hosts, 'server')
37
+ rescue ArgumentError =>e
38
+ server = only_host_with_role(hosts, 'default')
39
+ end
40
+
41
+ # Generate and install PKI certificates on each SUT
42
+ Dir.mktmpdir do |cert_dir|
43
+ run_fake_pki_ca_on(server, hosts, cert_dir )
44
+ hosts.each{ |sut| copy_pki_to( sut, cert_dir, '/etc/pki/simp-testing' )}
45
+ end
46
+
47
+ # add PKI keys
48
+ copy_keydist_to(server)
49
+ rescue StandardError, ScriptError => e
50
+ if ENV['PRY']
51
+ require 'pry'; binding.pry
52
+ else
53
+ raise e
54
+ end
55
+ end
56
+ end
25
57
  end
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.24.2
4
+ version: 1.25.0
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: 2022-03-10 00:00:00.000000000 Z
12
+ date: 2022-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: beaker
@@ -37,14 +37,14 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '6.2'
40
+ version: '7.1'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '6.2'
47
+ version: '7.1'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: beaker-puppet
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -125,20 +125,6 @@ dependencies:
125
125
  - - "<"
126
126
  - !ruby/object:Gem::Version
127
127
  version: 2.0.0
128
- - !ruby/object:Gem::Dependency
129
- name: beaker-puppet_install_helper
130
- requirement: !ruby/object:Gem::Requirement
131
- requirements:
132
- - - "~>"
133
- - !ruby/object:Gem::Version
134
- version: '0.9'
135
- type: :runtime
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- requirements:
139
- - - "~>"
140
- - !ruby/object:Gem::Version
141
- version: '0.9'
142
128
  - !ruby/object:Gem::Dependency
143
129
  name: highline
144
130
  requirement: !ruby/object:Gem::Requirement
@@ -167,20 +153,6 @@ dependencies:
167
153
  - - "~>"
168
154
  - !ruby/object:Gem::Version
169
155
  version: '1.8'
170
- - !ruby/object:Gem::Dependency
171
- name: net-telnet
172
- requirement: !ruby/object:Gem::Requirement
173
- requirements:
174
- - - "~>"
175
- - !ruby/object:Gem::Version
176
- version: 0.1.1
177
- type: :runtime
178
- prerelease: false
179
- version_requirements: !ruby/object:Gem::Requirement
180
- requirements:
181
- - - "~>"
182
- - !ruby/object:Gem::Version
183
- version: 0.1.1
184
156
  description: " Beaker helper methods to help scaffold SIMP acceptance tests\n"
185
157
  email: simp@simp-project.org
186
158
  executables: []
@@ -219,6 +191,7 @@ files:
219
191
  - lib/simp/beaker_helpers/windows.rb
220
192
  - lib/simp/rake/beaker.rb
221
193
  - simp-beaker-helpers.gemspec
194
+ - spec/acceptance/nodesets/amzn2.yml
222
195
  - spec/acceptance/nodesets/default.yml
223
196
  - spec/acceptance/nodesets/docker.yml
224
197
  - spec/acceptance/nodesets/oel.yml