simp-beaker-helpers 1.14.6 → 1.15.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +17 -1
- data/lib/simp/beaker_helpers.rb +80 -2
- data/lib/simp/beaker_helpers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ae38ba6a8abf04ebcf8c78edb90ea7ee09738c5f36fd8437b0285f2f8a0ea5e
|
4
|
+
data.tar.gz: 90d4bfe736422f86ec0ae97047e95d8272bf1c0f7e0f6efb7746814f26936efd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80d24259b08a0841f9e7323ad7d37bdbf975c1d7359c17cd0c0f480b9a2e8d104ec74c6e1ee16a5d067d1cc9c463b8717481beb3ec98f7d988b9a021b132b397
|
7
|
+
data.tar.gz: 1d5de7bb97debe274e604ad1a7e5b3901ac8ccaf6e25d9e0bdc3bb7e9dd932d7b3adcaa2e409a2bf7352c12083b76d3ef705b81b8d83868d09796a51b4f79acc
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -42,6 +42,8 @@ Methods to assist beaker acceptance tests for SIMP.
|
|
42
42
|
* [`BEAKER_use_fixtures_dir_for_modules`](#beaker_use_fixtures_dir_for_modules)
|
43
43
|
* [`BEAKER_no_fix_interfaces`](#beaker_no_fix_interfaces)
|
44
44
|
* [PUPPET_VERSION](#puppet_version)
|
45
|
+
* [BEAKER_RHSM_USER](#beaker_rhsm_user)
|
46
|
+
* [BEAKER_RHSM_PASS](#beaker_rhsm_pass)
|
45
47
|
* [Examples](#examples)
|
46
48
|
* [Prep OS, Generate and copy PKI certs to each SUT](#prep-os-generate-and-copy-pki-certs-to-each-sut)
|
47
49
|
* [Specify the version of Puppet to run in the SUTs](#specify-the-version-of-puppet-to-run-in-the-suts)
|
@@ -383,8 +385,22 @@ The `PUPPET_VERSION` environment variable will install the latest
|
|
383
385
|
`BEAKER_PUPPET_AGENT_VERSION` and `PUPPET_INSTALL_VERSION` are synonyms of
|
384
386
|
`PUPPET_VERSION`.
|
385
387
|
|
386
|
-
|
388
|
+
#### BEAKER_RHSM_USER
|
389
|
+
|
390
|
+
The username to use with Red Hat Subscription Manager when dealing with a RHEL host.
|
391
|
+
|
392
|
+
Will not be output to the screen.
|
393
|
+
|
394
|
+
#### BEAKER_RHSM_PASS
|
387
395
|
|
396
|
+
The password to use with Red Hat Subscription Manager when dealing with a RHEL host.
|
397
|
+
|
398
|
+
Will not be output to the screen.
|
399
|
+
|
400
|
+
Note: When using Subscription Manager, make sure your nodeset has the setting validation: false. Otherwise Beaker:Rspec
|
401
|
+
might try to install packages before subscription manager is configured.
|
402
|
+
|
403
|
+
## Examples
|
388
404
|
|
389
405
|
### Prep OS, Generate and copy PKI certs to each SUT
|
390
406
|
This pattern serves to prepare component modules that use PKI
|
data/lib/simp/beaker_helpers.rb
CHANGED
@@ -434,7 +434,6 @@ module Simp::BeakerHelpers
|
|
434
434
|
|
435
435
|
user_info = on(sut, 'getent passwd').stdout.lines
|
436
436
|
|
437
|
-
cmd = []
|
438
437
|
# Hash of user => home_dir
|
439
438
|
# Exclude silly directories
|
440
439
|
# * /
|
@@ -471,6 +470,18 @@ module Simp::BeakerHelpers
|
|
471
470
|
end
|
472
471
|
|
473
472
|
if fact_on(sut, 'osfamily') == 'RedHat'
|
473
|
+
if fact_on(sut, 'operatingsystem') == 'RedHat'
|
474
|
+
RSpec.configure do |c|
|
475
|
+
c.before(:all) do
|
476
|
+
rhel_rhsm_subscribe(sut)
|
477
|
+
end
|
478
|
+
|
479
|
+
c.after(:all) do
|
480
|
+
rhel_rhsm_unsubscribe(sut)
|
481
|
+
end
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
474
485
|
enable_yum_repos_on(sut)
|
475
486
|
|
476
487
|
# net-tools required for netstat utility being used by be_listening
|
@@ -486,6 +497,74 @@ module Simp::BeakerHelpers
|
|
486
497
|
end
|
487
498
|
end
|
488
499
|
|
500
|
+
# Register a RHEL system with a development license
|
501
|
+
#
|
502
|
+
# Must set BEAKER_RHSM_USER and BEAKER_RHSM_PASS environment variables or pass them in as
|
503
|
+
# parameters
|
504
|
+
def rhel_rhsm_subscribe(sut, *opts)
|
505
|
+
require 'securerandom'
|
506
|
+
|
507
|
+
rhsm_opts = {
|
508
|
+
:username => ENV['BEAKER_RHSM_USER'],
|
509
|
+
:password => ENV['BEAKER_RHSM_PASS'],
|
510
|
+
:system_name => "#{sut}_beaker_#{Time.now.to_i}_#{SecureRandom.uuid}",
|
511
|
+
:repo_list => {
|
512
|
+
'7' => [
|
513
|
+
'rhel-7-server-extras-rpms',
|
514
|
+
'rhel-7-server-optional-rpms',
|
515
|
+
'rhel-7-server-rh-common-rpms',
|
516
|
+
'rhel-7-server-rpms',
|
517
|
+
'rhel-7-server-supplementary-rpms'
|
518
|
+
],
|
519
|
+
'8' => [
|
520
|
+
'rhel-8-for-x86_64-baseos-rpms',
|
521
|
+
'rhel-8-for-x86_64-supplementary-rpms'
|
522
|
+
]
|
523
|
+
}
|
524
|
+
}
|
525
|
+
|
526
|
+
if opts && opts.is_a?(Hash)
|
527
|
+
rhsm_opts.merge!(opts)
|
528
|
+
end
|
529
|
+
|
530
|
+
os = fact_on(sut, 'operatingsystem').strip
|
531
|
+
os_release = fact_on(sut, 'operatingsystemmajrelease').strip
|
532
|
+
|
533
|
+
if os == 'RedHat'
|
534
|
+
unless rhsm_opts[:username] && rhsm_opts[:password]
|
535
|
+
fail("You must set BEAKER_RHSM_USER and BEAKER_RHSM_PASS environment variables to register RHEL systems")
|
536
|
+
end
|
537
|
+
|
538
|
+
sub_status = on(sut, 'subscription-manager status', :accept_all_exit_codes => true)
|
539
|
+
unless sub_status.exit_code == 0
|
540
|
+
logger.info("Registering #{sut} via subscription-manager")
|
541
|
+
on(sut, %{subscription-manager register --auto-attach --name='#{rhsm_opts[:system_name]}' --username='#{rhsm_opts[:username]}' --password='#{rhsm_opts[:password]}'}, :silent => true)
|
542
|
+
end
|
543
|
+
|
544
|
+
if rhsm_opts[:repo_list][os_release]
|
545
|
+
rhel_repo_enable(sut, rhsm_opts[:repo_list][os_release])
|
546
|
+
else
|
547
|
+
logger.warn("simp-beaker-helpers:#{__method__} => Default repos for RHEL '#{os_release}' not found")
|
548
|
+
end
|
549
|
+
end
|
550
|
+
end
|
551
|
+
|
552
|
+
def rhel_repo_enable(sut, repos)
|
553
|
+
Array(repos).each do |repo|
|
554
|
+
on(sut, %{subscription-manager repos --enable #{repo}})
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
def rhel_repo_disable(sut, repos)
|
559
|
+
Array(repos).each do |repo|
|
560
|
+
on(sut, %{subscription-manager repos --disable #{repo}}, :accept_all_exit_codes => true)
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
def rhel_rhsm_unsubscribe(sut)
|
565
|
+
on(sut, %{subscription-manager unregister}, :accept_all_exit_codes => true)
|
566
|
+
end
|
567
|
+
|
489
568
|
# Apply known OS fixes we need to run Beaker on each SUT
|
490
569
|
def fix_errata_on( suts = hosts )
|
491
570
|
parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
|
@@ -980,7 +1059,6 @@ done
|
|
980
1059
|
# 'simp_deps'
|
981
1060
|
#
|
982
1061
|
def install_simp_repos(sut, disable = [] )
|
983
|
-
|
984
1062
|
repos = {
|
985
1063
|
'simp' => {
|
986
1064
|
:baseurl => 'https://packagecloud.io/simp-project/6_X/el/$releasever/$basearch',
|
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.
|
4
|
+
version: 1.15.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: 2019-08-
|
12
|
+
date: 2019-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: beaker
|