simp-beaker-helpers 1.20.1 → 1.21.2

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: 7fc677903ad549041397ba842f11a2861c5e99b0b6c9717e0ac48e61485b6a7a
4
- data.tar.gz: 824a685974d1bb8df8ba9335d1176c4ea281d77f79d7ecc76c3fd68b88a82a79
3
+ metadata.gz: 6c454a97bb3100de8137245a8f4e328451e4048665c482db961c668cb820c972
4
+ data.tar.gz: 1aed320014ebd403f631faeb3f29484f6cc55a4441a4e499beab7409e289f101
5
5
  SHA512:
6
- metadata.gz: 31f997ddbe976bdfbc8fd904a7f8db3a972c6cfb47b62db12483fef311d1eb550caa2fd643e6abaf6dadd92063c288edb9217b472564b3c74af170f828449680
7
- data.tar.gz: 7e3a00581115a489502e13f542246aed81be117d104df938b4097e086300649a732c9d6e9094a3e6696cf35b24a30b63a10df9db71158d298a88919530a9bc8d
6
+ metadata.gz: b1df4f0b7411eead1d2c0d49f4f16d7a4f5dde7162ce91cb3fcba07018382508e56a8e16fdd65f06ee0b74fa2f4e6d036a7ea7f1d3c292964ce4face723bbb04
7
+ data.tar.gz: 82fb880cc4c7c975aa7a4b44134ec88f6d34d7a30431914c22b2616e54880b00ec647221779dda3d12e2b3f99923af49d3ce49a03efa20d04d318db3457189a4
@@ -1,3 +1,16 @@
1
+ ### 1.21.2 / 2021-01-15
2
+ * Fixed version mismatch. 1.21.1 was tagged with an incorrect version
3
+ in version.rb.
4
+
5
+ ### 1.21.1 / 2021-01-13
6
+ * Added:
7
+ * update_package_from_centos_stream method
8
+ * install_latest_package_on method
9
+ * Fixed:
10
+ * Removed some of the extraneous calls to facter
11
+ * Automatically pull the CentOS 8 kernel to the latest version in
12
+ CentOS-Stream to work around issues on FIPS systems
13
+
1
14
  ### 1.20.1 / 2021-01-08
2
15
  * Fixed:
3
16
  * Ensure that yum calls commands appropriately depending on whether or not
@@ -18,6 +18,30 @@ module Simp::BeakerHelpers
18
18
  "simp-beaker-helpers-#{t}-#{$$}-#{rand(0x100000000).to_s(36)}.tmp"
19
19
  end
20
20
 
21
+ def install_latest_package_on(sut, package_name, package_source=nil, opts={})
22
+ default_opts = {
23
+ max_retries: 3,
24
+ retry_interval: 10
25
+ }
26
+
27
+ package_source = package_name unless package_source
28
+
29
+ if sut.check_for_package(package_name)
30
+ sut.upgrade_package(
31
+ package_source,
32
+ '',
33
+ default_opts.merge(opts)
34
+ )
35
+ else
36
+ sut.install_package(
37
+ package_source,
38
+ '',
39
+ nil,
40
+ default_opts.merge(opts)
41
+ )
42
+ end
43
+ end
44
+
21
45
  def is_windows?(sut)
22
46
  sut[:platform] =~ /windows/i
23
47
  end
@@ -327,7 +351,7 @@ module Simp::BeakerHelpers
327
351
 
328
352
  def munge_ssh_crypto_policies(sut, key_types=['ssh-rsa'])
329
353
  if has_crypto_policies(sut)
330
- on(sut, "yum update -y crypto-policies", :accept_all_exit_codes => true)
354
+ install_latest_package_on(sut, 'crypto-policies', nil, :accept_all_exit_codes => true)
331
355
 
332
356
  # Since we may be doing this prior to having a box flip into FIPS mode, we
333
357
  # need to find and modify *all* of the affected policies
@@ -497,15 +521,10 @@ module Simp::BeakerHelpers
497
521
 
498
522
  # This is based on the official EPEL docs https://fedoraproject.org/wiki/EPEL
499
523
  if ['RedHat', 'CentOS'].include?(os_info['name'])
500
- # EL7 returns 1 if install is called and there is nothing to do
501
- yum_operation = 'install'
502
- yum_operation = 'update' if sut.check_for_package('epel-release')
503
-
504
- on(
524
+ install_latest_package_on(
505
525
  sut,
506
- %{yum #{yum_operation} -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-#{os_maj_rel}.noarch.rpm},
507
- :max_retries => 3,
508
- :retry_interval => 10
526
+ 'epel-release',
527
+ "https://dl.fedoraproject.org/pub/epel/epel-release-latest-#{os_maj_rel}.noarch.rpm",
509
528
  )
510
529
 
511
530
  if os_info['name'] == 'RedHat'
@@ -530,11 +549,19 @@ module Simp::BeakerHelpers
530
549
  end
531
550
  end
532
551
 
552
+ def update_package_from_centos_stream(sut, package_name)
553
+ sut.install_package('centos-release-stream') unless sut.check_for_package('centos-release-stream')
554
+ install_latest_package_on(sut, package_name)
555
+ sut.uninstall_package('centos-release-stream')
556
+ end
557
+
533
558
  def linux_errata( sut )
534
559
  # We need to be able to flip between server and client without issue
535
560
  on sut, 'puppet resource group puppet gid=52'
536
561
  on sut, 'puppet resource user puppet comment="Puppet" gid="52" uid="52" home="/var/lib/puppet" managehome=true'
537
562
 
563
+ os_info = fact_on(sut, 'os')
564
+
538
565
  # Make sure we have a domain on our host
539
566
  current_domain = fact_on(sut, 'domain').strip
540
567
  hostname = fact_on(sut, 'hostname').strip
@@ -601,8 +628,9 @@ module Simp::BeakerHelpers
601
628
  configure_type_defaults_on(sut)
602
629
  end
603
630
 
604
- if fact_on(sut, 'osfamily') == 'RedHat'
605
- if fact_on(sut, 'operatingsystem') == 'RedHat'
631
+ if os_info['family'] == 'RedHat'
632
+ # OS-specific items
633
+ if os_info['name'] == 'RedHat'
606
634
  RSpec.configure do |c|
607
635
  c.before(:all) do
608
636
  rhel_rhsm_subscribe(sut)
@@ -614,19 +642,28 @@ module Simp::BeakerHelpers
614
642
  end
615
643
  end
616
644
 
617
- enable_yum_repos_on(sut)
618
- enable_epel_on(sut)
645
+ if ['CentOS','RedHat','OracleLinux'].include?(os_info['name'])
646
+ enable_yum_repos_on(sut)
647
+ enable_epel_on(sut)
619
648
 
620
- # net-tools required for netstat utility being used by be_listening
621
- if fact_on(sut, 'operatingsystemmajrelease') == '7'
622
- pp = <<-EOS
623
- package { 'net-tools': ensure => installed }
624
- EOS
625
- apply_manifest_on(sut, pp, :catch_failures => false)
626
- end
649
+ # net-tools required for netstat utility being used by be_listening
650
+ if os_info['release']['major'].to_i >= 7
651
+ pp = <<-EOS
652
+ package { 'net-tools': ensure => installed }
653
+ EOS
654
+ apply_manifest_on(sut, pp, :catch_failures => false)
655
+ end
656
+
657
+ if (os_info['name'] == 'CentOS') && (os_info['release']['major'].to_i >= 8)
658
+ if os_info['release']['minor'].to_i == 3
659
+ update_package_from_centos_stream(sut, 'kernel')
660
+ sut.reboot
661
+ end
662
+ end
627
663
 
628
- # Clean up YUM prior to starting our test runs.
629
- on(sut, 'yum clean all')
664
+ # Clean up YUM prior to starting our test runs.
665
+ on(sut, 'yum clean all')
666
+ end
630
667
  end
631
668
  end
632
669
 
@@ -687,7 +724,7 @@ module Simp::BeakerHelpers
687
724
  end
688
725
 
689
726
  def sosreport(sut, dest='sosreports')
690
- on(sut, 'puppet resource package sos ensure=latest')
727
+ install_latest_package_on(sut, 'sos')
691
728
  on(sut, 'sosreport --batch')
692
729
 
693
730
  files = on(sut, 'ls /var/tmp/sosreport* /tmp/sosreport* 2>/dev/null', :accept_all_exit_codes => true).output.lines.map(&:strip)
@@ -873,18 +910,18 @@ module Simp::BeakerHelpers
873
910
  # Need to hash all of the CA certificates so that apps can use them
874
911
  # properly! This must happen on the host itself since it needs to match
875
912
  # the native hashing algorithms.
876
- hash_cmd = <<-EOM.strip
877
- cd #{sut_pki_dir}/cacerts; \
878
- for x in *; do \
879
- if [ ! -h "$x" ]; then \
880
- `openssl x509 -in $x >/dev/null 2>&1`; \
881
- if [ $? -eq 0 ]; then \
882
- hash=`openssl x509 -in $x -hash | head -1`; \
883
- ln -sf $x $hash.0; \
884
- fi; \
885
- fi; \
886
- done
887
- EOM
913
+ hash_cmd = <<~EOM.strip
914
+ cd #{sut_pki_dir}/cacerts; \
915
+ for x in *; do \
916
+ if [ ! -h "$x" ]; then \
917
+ `openssl x509 -in $x >/dev/null 2>&1`; \
918
+ if [ $? -eq 0 ]; then \
919
+ hash=`openssl x509 -in $x -hash | head -1`; \
920
+ ln -sf $x $hash.0; \
921
+ fi; \
922
+ fi; \
923
+ done
924
+ EOM
888
925
 
889
926
  on(sut, hash_cmd)
890
927
  end
@@ -1299,26 +1336,11 @@ done
1299
1336
  def install_simp_repos(sut, disable = [])
1300
1337
  # NOTE: Do *NOT* use puppet in this method since it may not be available yet
1301
1338
 
1302
- # EL7 returns 1 if install is called and there is nothing to do
1303
- yum_operation = 'install'
1304
- yum_operation = 'update' if sut.check_for_package('yum-utils')
1305
-
1306
- on(
1307
- sut,
1308
- "yum -y #{yum_operation} yum-utils",
1309
- :max_retries => 3,
1310
- :retry_interval => 10
1311
- )
1312
-
1313
- # EL7 returns 1 if install is called and there is nothing to do
1314
- yum_operation = 'install'
1315
- yum_operation = 'update' if sut.check_for_package('simp-release-community')
1316
-
1317
- on(
1339
+ install_latest_package_on(sut, 'yum-utils')
1340
+ install_latest_package_on(
1318
1341
  sut,
1319
- %{yum -y #{yum_operation} "https://download.simp-project.com/simp-release-community.rpm"},
1320
- :max_retries => 3,
1321
- :retry_interval => 10
1342
+ 'simp-release-community',
1343
+ "https://download.simp-project.com/simp-release-community.rpm",
1322
1344
  )
1323
1345
 
1324
1346
  to_disable = disable.dup
@@ -1,5 +1,5 @@
1
1
  module Simp; end
2
2
 
3
3
  module Simp::BeakerHelpers
4
- VERSION = '1.20.1'
4
+ VERSION = '1.21.2'
5
5
  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.20.1
4
+ version: 1.21.2
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-10 00:00:00.000000000 Z
12
+ date: 2021-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: beaker