simp-beaker-helpers 1.23.4 → 1.24.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: 4a8f3a3f4dc773c215796e464031e1ab00ed025c9a3346fd4573d12a1a072fd9
4
- data.tar.gz: 1d55ad88ebae56afe2e807ad1a27d3e6ee5828499ef2f3655770b71f8660d579
3
+ metadata.gz: 4403e18b35abbd1622d13e0fac49c4c22a20bf6b80b142b9db9fb5743a96bdf0
4
+ data.tar.gz: a490a356a2e18cda7611213d53e0202a3790377e722cd23d56228766d93351a5
5
5
  SHA512:
6
- metadata.gz: 10d292eb75b4bcd9d2bfc2bc5223367ea2706db88cdc29d016b37db9864530d6a923e56339d1f37a5b4e9b9cf1edeb34c179d73d5a56361416145a363c02890e
7
- data.tar.gz: f877ae87cf79c64786aeaf800cb1d8b839ad251c80664e128b498a7e555d9661a7034e677d1682bcbc91fb8ce00ba504f5ed22035ad6ed877df45d0c8851b241
6
+ metadata.gz: 9d9ab525dd5345fac7fb7c66fb8aab2c8449b6fce2e5812518a4341d8bdbd5a208e5a31c5b12fc912e664f1f4dbb11fb41419576eddd1fe09844f4aaa8af4cf2
7
+ data.tar.gz: 26a688025f283009ba338823369e26a2d65db16db212592ab9fe3432f3c1892b251ec176c1c0faa6a5f7abab727c4d2d25994c8af316a199027279a4ffec02d1
@@ -63,7 +63,7 @@ jobs:
63
63
  # we restrict ourselves to sending data elsewhere.
64
64
  glci-syntax:
65
65
  name: '.gitlab-ci.yml Syntax'
66
- runs-on: ubuntu-16.04
66
+ runs-on: ubuntu-latest
67
67
  outputs:
68
68
  valid: ${{ steps.validate-glci-file.outputs.valid }}
69
69
  steps:
@@ -174,7 +174,7 @@ jobs:
174
174
  ### examine_contexts:
175
175
  ### name: 'Examine Context contents'
176
176
  ### if: always()
177
- ### runs-on: ubuntu-16.04
177
+ ### runs-on: ubuntu-latest
178
178
  ### needs: [ glci-syntax, contributor-permissions ]
179
179
  ### steps:
180
180
  ### - name: Dump contexts
@@ -93,7 +93,7 @@ jobs:
93
93
  ### examine_contexts:
94
94
  ### name: 'Examine Context contents'
95
95
  ### if: always()
96
- ### runs-on: ubuntu-16.04
96
+ ### runs-on: ubuntu-latest
97
97
  ### steps:
98
98
  ### - name: Dump contexts
99
99
  ### env:
@@ -1,4 +1,4 @@
1
- # Build & Deploy RubyGem & GitHub release when a SemVer tag is pushed
1
+ # When SemVer tag is pushed: create GitHub release & publish gem to rubygems.org
2
2
  #
3
3
  # This workflow's jobs are only triggered in repos under the `simp` organization
4
4
  # ------------------------------------------------------------------------------
data/.gitlab-ci.yml CHANGED
@@ -273,10 +273,6 @@ variables:
273
273
  # Unit Tests
274
274
  #-----------------------------------------------------------------------
275
275
 
276
- pup5.x-unit:
277
- <<: *pup_5_x
278
- <<: *unit_tests
279
-
280
276
  pup6.x-unit:
281
277
  <<: *pup_6_x
282
278
  <<: *unit_tests
@@ -292,12 +288,6 @@ pup7.x-unit:
292
288
  #=======================================================================
293
289
  # Packaging test
294
290
 
295
- pup5.x-pkg:
296
- <<: *pup_5_x
297
- <<: *unit_tests
298
- script:
299
- 'bundle exec rake pkg:gem'
300
-
301
291
  pup6.x-pkg:
302
292
  <<: *pup_6_x
303
293
  <<: *unit_tests
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ### 1.24.0 / 2021-10-05
2
+ * Fixed:
3
+ * Pinned the version of inspec to 4.39.0 since 4.41 broke tag processing
4
+ * Only call `activate_interfaces` once per test run instead of at each context
5
+ which saves quite a bit of time during testing
6
+ * SSG tag selection logic
7
+ * Use `sed -ci` which works with docker volume mounts
8
+ * Added:
9
+ * Modified the `activate_interfaces` method to use the `networking` fact if
10
+ available which shaves quite a bit of time off of each test run
11
+
1
12
  ### 1.23.4 / 2021-07-07
2
13
  * Fixed:
3
14
  * Ensure that the openscap-scanner package is installed during SSG runs
data/Gemfile CHANGED
@@ -45,7 +45,7 @@ group :system_tests do
45
45
  gem 'beaker-windows'
46
46
  gem 'net-ssh'
47
47
  gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 6.0')
48
- gem 'puppetlabs_spec_helper'
48
+ gem 'puppetlabs_spec_helper', '~> 3.0'
49
49
  gem 'rubocop'
50
50
  gem 'rubocop-rspec'
51
51
  end
data/files/pki/make.sh CHANGED
@@ -73,7 +73,7 @@ for hosts in $*; do
73
73
  done
74
74
  done
75
75
 
76
- sed -i "s/# subjectAltName = #ALTNAMES#/subjectAltName = ${altnames}/" "working/${hname}.cnf"
76
+ sed -ci "s/# subjectAltName = #ALTNAMES#/subjectAltName = ${altnames}/" "working/${hname}.cnf"
77
77
  fi
78
78
 
79
79
  echo "-- running openssl req"
@@ -34,7 +34,9 @@ module Simp::BeakerHelpers
34
34
  # The name of the profile against which to run
35
35
  #
36
36
  def initialize(sut, profile)
37
- @inspec_version = ENV['BEAKER_inspec_version'] || 'latest'
37
+ # The 4.41 release is currently broken
38
+ # @inspec_version = ENV['BEAKER_inspec_version'] || 'latest'
39
+ @inspec_version = ENV['BEAKER_inspec_version'] || '4.39.0'
38
40
 
39
41
  @sut = sut
40
42
 
@@ -407,7 +407,7 @@ module Simp::BeakerHelpers
407
407
  else
408
408
  tags = on(@sut, %(cd scap-content; git tag -l)).output
409
409
  target_tag = tags.lines.map(&:strip)
410
- .select{|x| x.start_with?(/v\d+\./)}
410
+ .select{|x| x.match?(/^v(\d+\.)+\d+$/)}
411
411
  .sort.last
412
412
 
413
413
  on(@sut, %(cd scap-content; git checkout #{target_tag}))
@@ -419,7 +419,7 @@ module Simp::BeakerHelpers
419
419
  #
420
420
  # This isn't 100% correct but it's "good enough" for an automated CI
421
421
  # environment to tell us if something is critically out of alignment.
422
- on(@sut, %(cd scap-content/build-scripts; sed -i 's/ssg.build_derivatives.profile_handling/#ssg.build_derivatives.profile_handling/g' enable_derivatives.py))
422
+ on(@sut, %(cd scap-content/build-scripts; sed -ci 's/ssg.build_derivatives.profile_handling/#ssg.build_derivatives.profile_handling/g' enable_derivatives.py))
423
423
 
424
424
  on(@sut, %(cd scap-content/build; cmake ../; make -j4 #{OS_INFO[@os][@os_rel]['ssg']['build_target']}-content && cp *ds.xml #{@scap_working_dir}))
425
425
  end
@@ -1,5 +1,5 @@
1
1
  module Simp; end
2
2
 
3
3
  module Simp::BeakerHelpers
4
- VERSION = '1.23.4'
4
+ VERSION = '1.24.0'
5
5
  end
@@ -483,7 +483,7 @@ module Simp::BeakerHelpers
483
483
  # that doesn't break vagrant access and is appropriate for
484
484
  # typical module tests.)
485
485
  fips_ssh_ciphers = [ 'aes256-ctr','aes192-ctr','aes128-ctr']
486
- on(sut, %(sed -i '/Ciphers /d' /etc/ssh/sshd_config))
486
+ on(sut, %(sed -ci '/Ciphers /d' /etc/ssh/sshd_config))
487
487
  on(sut, %(echo 'Ciphers #{fips_ssh_ciphers.join(',')}' >> /etc/ssh/sshd_config))
488
488
 
489
489
  fips_enable_modulepath = ''
@@ -688,7 +688,7 @@ module Simp::BeakerHelpers
688
688
  if current_domain.empty?
689
689
  new_fqdn = hostname + '.beaker.test'
690
690
 
691
- on(sut, "sed -i 's/#{hostname}.*/#{new_fqdn} #{hostname}/' /etc/hosts")
691
+ on(sut, "sed -ci 's/#{hostname}.*/#{new_fqdn} #{hostname}/' /etc/hosts")
692
692
  on(sut, "echo '#{new_fqdn}' > /etc/hostname", :accept_all_exit_codes => true)
693
693
  on(sut, "hostname #{new_fqdn}", :accept_all_exit_codes => true)
694
694
 
@@ -953,21 +953,31 @@ module Simp::BeakerHelpers
953
953
  host_entry[fqdn] << host.name if (host[:hypervisor] == 'docker')
954
954
 
955
955
  # Ensure that all interfaces are active prior to collecting data
956
- activate_interfaces(host) unless ENV['BEAKER_no_fix_interfaces']
956
+ activate_interfaces(host)
957
957
 
958
- # Gather the IP Addresses for the host to embed in the cert
959
- interfaces = fact_on(host, 'interfaces').strip.split(',')
960
- interfaces.each do |interface|
961
- ipaddress = fact_on(host, "ipaddress_#{interface}")
958
+ networking_fact = pfact_on(host, 'networking')
959
+ if networking_fact && networking_fact['interfaces']
960
+ networking_fact['interfaces'].each do |iface, data|
961
+ next unless data['ip']
962
+ next if data['ip'].start_with?('127.')
962
963
 
963
- next if ipaddress.nil? || ipaddress.empty? || ipaddress.start_with?('127.')
964
+ host_entry[fqdn] << data['ip'].strip
965
+ end
966
+ else
967
+ # Gather the IP Addresses for the host to embed in the cert
968
+ interfaces = fact_on(host, 'interfaces').strip.split(',')
969
+ interfaces.each do |interface|
970
+ ipaddress = fact_on(host, "ipaddress_#{interface}")
964
971
 
965
- host_entry[fqdn] << ipaddress.strip
972
+ next if ipaddress.nil? || ipaddress.empty? || ipaddress.start_with?('127.')
966
973
 
967
- unless host_entry[fqdn].empty?
968
- suts_network_info[fqdn] = host_entry[fqdn].sort.uniq
974
+ host_entry[fqdn] << ipaddress.strip
969
975
  end
970
976
  end
977
+
978
+ unless host_entry[fqdn].empty?
979
+ suts_network_info[fqdn] = host_entry[fqdn].sort.uniq
980
+ end
971
981
  end
972
982
 
973
983
  # Get all of the repeated SUT IP addresses:
@@ -1072,7 +1082,6 @@ module Simp::BeakerHelpers
1072
1082
  on ca_sut, "chgrp -R puppet #{host_keydist_dir}"
1073
1083
  end
1074
1084
 
1075
-
1076
1085
  # Activate all network interfaces on the target system
1077
1086
  #
1078
1087
  # This is generally needed if the upstream vendor does not activate all
@@ -1080,6 +1089,8 @@ module Simp::BeakerHelpers
1080
1089
  #
1081
1090
  # Can be passed any number of hosts either singly or as an Array
1082
1091
  def activate_interfaces(hosts)
1092
+ return if ENV['BEAKER_no_fix_interfaces']
1093
+
1083
1094
  parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
1084
1095
  block_on(hosts, :run_in_parallel => parallel) do |host|
1085
1096
  if host[:platform] =~ /windows/
@@ -1087,14 +1098,22 @@ module Simp::BeakerHelpers
1087
1098
  next
1088
1099
  end
1089
1100
 
1090
- interfaces_fact = pfact_on(host, 'interfaces')
1101
+ networking_fact = pfact_on(host, 'networking')
1102
+ if networking_fact && networking_fact['interfaces']
1103
+ networking_fact['interfaces'].each do |iface, data|
1104
+ next if ( ( data['ip'] && !data['ip'].empty? ) || ( data['ip6'] && !data['ip6'].empty? ) )
1105
+ on(host, "ifup #{iface}", :accept_all_exit_codes => true)
1106
+ end
1107
+ else
1108
+ interfaces_fact = pfact_on(host, 'interfaces')
1091
1109
 
1092
- interfaces = interfaces_fact.strip.split(',')
1093
- interfaces.delete_if { |x| x =~ /^lo/ }
1110
+ interfaces = interfaces_fact.strip.split(',')
1111
+ interfaces.delete_if { |x| x =~ /^lo/ }
1094
1112
 
1095
- interfaces.each do |iface|
1096
- if pfact_on(host, "ipaddress_#{iface}")
1097
- on(host, "ifup #{iface}", :accept_all_exit_codes => true)
1113
+ interfaces.each do |iface|
1114
+ if pfact_on(host, "ipaddress_#{iface}")
1115
+ on(host, "ifup #{iface}", :accept_all_exit_codes => true)
1116
+ end
1098
1117
  end
1099
1118
  end
1100
1119
  end
@@ -1111,12 +1130,9 @@ module Simp::BeakerHelpers
1111
1130
  RSpec.configure do |c|
1112
1131
  c.before(:all) do
1113
1132
  @temp_hieradata_dirs = @temp_hieradata_dirs || []
1114
- end
1115
1133
 
1116
- # We can't guarantee that the upstream vendor isn't disabling interfaces so
1117
- # we need to turn them on at each context run
1118
- c.before(:context) do
1119
- activate_interfaces(hosts) unless ENV['BEAKER_no_fix_interfaces']
1134
+ # We can't guarantee that the upstream vendor isn't disabling interfaces
1135
+ activate_interfaces(hosts)
1120
1136
  end
1121
1137
 
1122
1138
  c.after(:all) do
@@ -32,7 +32,7 @@ HOSTS:
32
32
  CONFIG:
33
33
  log_level: verbose
34
34
  type: aio
35
- vagrant_memsize: 256
35
+ vagrant_memsize: 512
36
36
  vagrant_cpus: 2
37
37
  <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
38
38
  puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
@@ -24,7 +24,7 @@ HOSTS:
24
24
  CONFIG:
25
25
  log_level: verbose
26
26
  type: aio
27
- vagrant_memsize: 512
27
+ vagrant_memsize: 1024
28
28
  vagrant_cpus: 2
29
29
  <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
30
30
  puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
@@ -14,7 +14,7 @@ HOSTS:
14
14
  CONFIG:
15
15
  log_level: verbose
16
16
  type: aio
17
- vagrant_memsize: 256
17
+ vagrant_memsize: 512
18
18
  <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
19
19
  puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
20
20
  <% 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.23.4
4
+ version: 1.24.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: 2021-07-13 00:00:00.000000000 Z
12
+ date: 2021-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: beaker