simp-beaker-helpers 1.21.3 → 1.23.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.fips_fixtures +1 -0
- data/.fixtures.yml +6 -1
- data/.github/workflows.local.json +6 -0
- data/.github/workflows/pr_acceptance.yml +55 -0
- data/.github/workflows/pr_glci.yml +190 -0
- data/.github/workflows/pr_glci_cleanup.yml +105 -0
- data/.github/workflows/pr_glci_manual.yml +143 -0
- data/.github/workflows/pr_tests.yml +90 -0
- data/.github/workflows/tag_deploy_rubygem.yml +192 -0
- data/.gitlab-ci.yml +37 -37
- data/CHANGELOG.md +56 -0
- data/Gemfile +1 -1
- data/README.md +63 -5
- data/lib/simp/beaker_helpers.rb +164 -61
- data/lib/simp/beaker_helpers/inspec.rb +16 -12
- data/lib/simp/beaker_helpers/ssg.rb +36 -12
- data/lib/simp/beaker_helpers/version.rb +1 -1
- data/lib/simp/rake/beaker.rb +14 -2
- data/simp-beaker-helpers.gemspec +5 -1
- data/spec/acceptance/nodesets/docker.yml +12 -10
- data/spec/acceptance/suites/default/enable_fips_spec.rb +6 -4
- data/spec/acceptance/suites/default/install_simp_deps_repo_spec.rb +17 -5
- data/spec/acceptance/suites/fips_from_fixtures/00_default_spec.rb +11 -3
- data/spec/acceptance/suites/inspec/00_default_spec.rb +54 -0
- data/spec/acceptance/suites/inspec/metadata.yml +2 -0
- data/spec/acceptance/suites/inspec/nodesets +1 -0
- data/spec/acceptance/suites/puppet_collections/00_default_spec.rb +1 -1
- data/spec/acceptance/suites/ssg/00_default_spec.rb +40 -0
- data/spec/acceptance/suites/ssg/metadata.yml +2 -0
- data/spec/acceptance/suites/ssg/nodesets +1 -0
- data/spec/lib/simp/beaker_helpers_spec.rb +1 -3
- metadata +54 -40
- data/.travis.yml +0 -42
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,59 @@
|
|
1
|
+
### 1.23.2 / 2021-05-29
|
2
|
+
* Fixed:
|
3
|
+
* Fail an acceptance test when an explicitly-specified nodeset for an
|
4
|
+
acceptance test suite does not exist and the suite is configured
|
5
|
+
to fail fast (default behavior).
|
6
|
+
* The usual way of registering RHEL systems had to be changed to activate
|
7
|
+
immediately when called to function properly.
|
8
|
+
|
9
|
+
### 1.23.1 / 2021-05-19
|
10
|
+
* Fixed:
|
11
|
+
* The SSG default branch is now the latest numeric tag instead of the one
|
12
|
+
closest to the head of the default branch. The tag closest to the default
|
13
|
+
branch has drifted over time.
|
14
|
+
* Removed direct call to `docker` when copying out inspec results
|
15
|
+
* Typos in `copy_in` when running against docker
|
16
|
+
* Added:
|
17
|
+
* `Simp::BeakerHelpers::Inspec.enable_repo_on(suts)` to allow users to easily
|
18
|
+
enable the Chef repos for inspec
|
19
|
+
* Beaker tests for inspec and SSG basic functionality
|
20
|
+
* GitHub Actions for acceptance testing where possible
|
21
|
+
|
22
|
+
### 1.23.0 / 2021-03-16
|
23
|
+
* Added:
|
24
|
+
* For `podman` support:
|
25
|
+
* Bumped the required beaker-docker to between 0.8.3 and 2.0.0
|
26
|
+
* Added a dependency on docker-api between 2.1.0 and 3.0.0
|
27
|
+
* Make SSG failures have verbose output to make remediation easier
|
28
|
+
* Fixed:
|
29
|
+
* Ensure that containers use the correct method for copying files
|
30
|
+
|
31
|
+
### 1.22.1 / 2021-03-01
|
32
|
+
* Fixed: enable_epel_on() now installs the correct EPEL repository
|
33
|
+
package on OracleLinux
|
34
|
+
|
35
|
+
### 1.22.0 / 2021-01-27
|
36
|
+
* Fixed:
|
37
|
+
* Ensure that the simp-crypto_policy module is installed when flipping to FIPS
|
38
|
+
mode
|
39
|
+
* Only attempt to install the simp repos once in case they are broken for some
|
40
|
+
reason
|
41
|
+
* Added:
|
42
|
+
* Documentation for all of the beaker environment variables
|
43
|
+
* set_simp_repo_release() for setting the release and release_type of the
|
44
|
+
public SIMP yum repos
|
45
|
+
* set_yum_opts_on() method for setting bulk yum config options
|
46
|
+
* set_yum_opt_on() method for setting singular yum config options
|
47
|
+
* install_package_unless_present_on() method
|
48
|
+
* Allow users to set repos to disable using an environment variable
|
49
|
+
* A total run time summary for beaker suites
|
50
|
+
|
51
|
+
### 1.21.4 / 2021-01-21
|
52
|
+
* Fixed:
|
53
|
+
* Reverted the use of OpenStruct due to issues with seralization
|
54
|
+
* Hash objects have a 'dig' method as of Ruby 2.3 so pinned this gem to a
|
55
|
+
minimum version of Ruby 2.3
|
56
|
+
|
1
57
|
### 1.21.3 / 2021-01-20
|
2
58
|
* Fixed:
|
3
59
|
* Allow all methods that can safely take SUT arrays to do so
|
data/Gemfile
CHANGED
@@ -13,7 +13,7 @@ gem 'bundler'
|
|
13
13
|
gem 'rake'
|
14
14
|
|
15
15
|
group :system_tests do
|
16
|
-
beaker_gem_options = ENV.fetch('BEAKER_GEM_OPTIONS', ['>= 4.
|
16
|
+
beaker_gem_options = ENV.fetch('BEAKER_GEM_OPTIONS', ['>= 4.28.1', '< 5.0.0'])
|
17
17
|
|
18
18
|
if "#{beaker_gem_options}".include?(':')
|
19
19
|
# Just pass in BEAKER_GEM_OPTIONS as a string that would represent the usual
|
data/README.md
CHANGED
@@ -13,6 +13,8 @@ Methods to assist beaker acceptance tests for SIMP.
|
|
13
13
|
* [`rake beaker:suites`](#rake-beakersuites)
|
14
14
|
* [Suite Execution](#suite-execution)
|
15
15
|
* [Environment Variables](#environment-variables)
|
16
|
+
* [Beaker Management](#beaker-management)
|
17
|
+
* [Beaker Helpers Adjustments](#beaker-helpers-adjustments)
|
16
18
|
* [Global Suite Configuration](#global-suite-configuration)
|
17
19
|
* [Supported Config:](#supported-config)
|
18
20
|
* [Individual Suite Configuration](#individual-suite-configuration)
|
@@ -112,12 +114,68 @@ sensitive).
|
|
112
114
|
|
113
115
|
#### Environment Variables
|
114
116
|
|
115
|
-
|
117
|
+
##### Beaker Management
|
118
|
+
|
119
|
+
* BEAKER_suite_runall [yes|no]
|
116
120
|
* Run all Suites
|
117
121
|
|
118
|
-
* BEAKER_suite_basedir
|
122
|
+
* BEAKER_suite_basedir [String]
|
119
123
|
* The base directory where suites will be defined
|
120
|
-
* Default: spec/acceptance
|
124
|
+
* Default: `spec/acceptance`
|
125
|
+
|
126
|
+
##### Beaker Helpers Adjustments
|
127
|
+
|
128
|
+
* BEAKER_SIMP_parallel [yes|no]
|
129
|
+
* `yes` => Run simp-beaker-helpers methods on SUTs in parallel if possible
|
130
|
+
* `no` => Do not run methods in parallel
|
131
|
+
|
132
|
+
* BEAKER_docker_cmd [String]
|
133
|
+
* The specific command to use for performing `docker` operations
|
134
|
+
|
135
|
+
* BEAKER_helpers_verbose [yes|no]
|
136
|
+
* `yes` => Enable verbose output
|
137
|
+
* `no` => Do not enable verbose output
|
138
|
+
|
139
|
+
* BEAKER_copy_fixtures [yes|no]
|
140
|
+
* `yes` => Enable copying fixtures to the SUT
|
141
|
+
* `no` => Disable copying fixtures to the SUT
|
142
|
+
|
143
|
+
* BEAKER_use_fixtures_dir_for_modules [yes|no]
|
144
|
+
* `yes` => Pull fixtures directly from `spec/fixtures/modules`
|
145
|
+
* `no` => Ignore `spec/fixtures/modules` content
|
146
|
+
|
147
|
+
* BEAKER_stringify_facts [yes|no]
|
148
|
+
* `yes` => Enable fact stringification
|
149
|
+
|
150
|
+
* BEAKER_fips_module_version [String]
|
151
|
+
* The specific version of the FIPS module to install from the puppet forge
|
152
|
+
|
153
|
+
* BEAKER_RHSM_USER [String]
|
154
|
+
* The username for using with RHSM
|
155
|
+
|
156
|
+
* BEAKER_RHSM_PASS [String]
|
157
|
+
* The password for using with RHSM
|
158
|
+
|
159
|
+
* BEAKER_fips [yes|no]
|
160
|
+
* `yes` => Enable FIPS on the SUT
|
161
|
+
* `no` => Do not manage FIPS on the SUT (will not disable if enabled)
|
162
|
+
|
163
|
+
* BEAKER_no_fix_interfaces [Boolean]
|
164
|
+
* If present, will not try to fix the interfaces on the SUT
|
165
|
+
|
166
|
+
* BEAKER_SIMP_install_repos [yes|no]
|
167
|
+
* `yes` => Install the SIMP YUM repositories
|
168
|
+
* `no` => No not install the SIMP YUM repositories
|
169
|
+
|
170
|
+
* BEAKER_SIMP_disable_repos [String]
|
171
|
+
* Comma delimited list of YUM repositories to disable on the SUT
|
172
|
+
|
173
|
+
* BEAKER_SIMP_repo_release [String]
|
174
|
+
* The release of SIMP to target in the YUM repos (usually a number)
|
175
|
+
|
176
|
+
* BEAKER_SIMP_repo_release_type [String]
|
177
|
+
* The release type of SIMP to target in the YUM repos
|
178
|
+
* Something like `stable`, `rolling`, or `unstable`
|
121
179
|
|
122
180
|
#### Global Suite Configuration
|
123
181
|
|
@@ -406,7 +464,7 @@ might try to install packages before subscription manager is configured.
|
|
406
464
|
The version of InSpec to use when running inspec tests. Currently hard-coded to
|
407
465
|
`4.16.14` due to a bug introduced in `4.16.15`.
|
408
466
|
|
409
|
-
|
467
|
+
Set to 'latest' to use the latest available in the upstream repos.
|
410
468
|
|
411
469
|
## Examples
|
412
470
|
|
@@ -510,7 +568,7 @@ underlying OS configuration.
|
|
510
568
|
|
511
569
|
`Simp::BeakerHelpers::Snapshot.save(sut, '<name of snapshot>')` will save a
|
512
570
|
snapshot with the given name. If the snapshot already exists, it will be
|
513
|
-
|
571
|
+
forcibly overwritten.
|
514
572
|
|
515
573
|
|
516
574
|
##### Base Snapshots
|
data/lib/simp/beaker_helpers.rb
CHANGED
@@ -18,7 +18,53 @@ module Simp::BeakerHelpers
|
|
18
18
|
"simp-beaker-helpers-#{t}-#{$$}-#{rand(0x100000000).to_s(36)}.tmp"
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
# Sets a single YUM option in the form that yum-config-manager/dnf
|
22
|
+
# config-manager would expect.
|
23
|
+
#
|
24
|
+
# If not prefaced with a repository, the option will be applied globally.
|
25
|
+
#
|
26
|
+
# Has no effect if yum or dnf is not present.
|
27
|
+
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
|
+
repo,target = key.split('.')
|
31
|
+
|
32
|
+
unless target
|
33
|
+
key = "\\*.#{repo}"
|
34
|
+
end
|
35
|
+
|
36
|
+
command = nil
|
37
|
+
if !sut.which('dnf').empty?
|
38
|
+
install_package_unless_present_on(sut, 'dnf-plugins-core', :accept_all_exit_codes => true)
|
39
|
+
command = 'dnf config-manager'
|
40
|
+
elsif !sut.which('yum').empty?
|
41
|
+
command = 'yum-config-manager'
|
42
|
+
end
|
43
|
+
|
44
|
+
on(sut, %{#{command} --save --setopt=#{key}=#{value}}, :silent => true) if command
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Takes a hash of YUM options to set in the form that yum-config-manager/dnf
|
49
|
+
# config-manager would expect.
|
50
|
+
#
|
51
|
+
# If not prefaced with a repository, the option will be applied globally.
|
52
|
+
#
|
53
|
+
# Example:
|
54
|
+
# {
|
55
|
+
# 'skip_if_unavailable' => '1', # Applies globally
|
56
|
+
# 'foo.installonly_limit' => '5' # Applies only to the 'foo' repo
|
57
|
+
# }
|
58
|
+
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|
|
61
|
+
yum_opts.each_pair do |k,v|
|
62
|
+
set_yum_opt_on(sut, k, v)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def install_package_unless_present_on(suts, package_name, package_source=nil, opts={})
|
22
68
|
default_opts = {
|
23
69
|
max_retries: 3,
|
24
70
|
retry_interval: 10
|
@@ -28,19 +74,35 @@ module Simp::BeakerHelpers
|
|
28
74
|
block_on(suts, :run_in_parallel => parallel) do |sut|
|
29
75
|
package_source = package_name unless package_source
|
30
76
|
|
31
|
-
|
32
|
-
sut.
|
77
|
+
unless sut.check_for_package(package_name)
|
78
|
+
sut.install_package(
|
33
79
|
package_source,
|
34
80
|
'',
|
81
|
+
nil,
|
35
82
|
default_opts.merge(opts)
|
36
83
|
)
|
37
|
-
|
38
|
-
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def install_latest_package_on(suts, package_name, package_source=nil, opts={})
|
89
|
+
default_opts = {
|
90
|
+
max_retries: 3,
|
91
|
+
retry_interval: 10
|
92
|
+
}
|
93
|
+
|
94
|
+
parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
|
95
|
+
block_on(suts, :run_in_parallel => parallel) do |sut|
|
96
|
+
package_source = package_name unless package_source
|
97
|
+
|
98
|
+
if sut.check_for_package(package_name)
|
99
|
+
sut.upgrade_package(
|
39
100
|
package_source,
|
40
101
|
'',
|
41
|
-
nil,
|
42
102
|
default_opts.merge(opts)
|
43
103
|
)
|
104
|
+
else
|
105
|
+
install_package_unless_present_on(sut, package_name, package_source, opts)
|
44
106
|
end
|
45
107
|
end
|
46
108
|
end
|
@@ -124,13 +186,18 @@ module Simp::BeakerHelpers
|
|
124
186
|
end
|
125
187
|
end
|
126
188
|
|
127
|
-
unless directory_exists_on(sut, dest)
|
128
|
-
dest = File.dirname(dest)
|
129
|
-
sut.mkdir_p(dest)
|
130
|
-
end
|
189
|
+
sut.mkdir_p(File.dirname(dest)) unless directory_exists_on(sut, dest)
|
131
190
|
|
132
|
-
|
191
|
+
if File.file?(src)
|
192
|
+
cmd = %{#{docker_cmd} cp "#{src}" "#{container_id}:#{dest}"}
|
193
|
+
else
|
194
|
+
cmd = [
|
195
|
+
%{tar #{exclude_list.join(' ')} -hcf - -C "#{File.dirname(src)}" "#{File.basename(src)}"},
|
196
|
+
%{#{docker_cmd} exec -i "#{container_id}" tar -C "#{dest}" -xf -}
|
197
|
+
].join(' | ')
|
198
|
+
end
|
133
199
|
|
200
|
+
%x(#{cmd})
|
134
201
|
elsif rsync_functional_on?(sut)
|
135
202
|
# This makes rsync_to work like beaker and scp usually do
|
136
203
|
exclude_hack = %(__-__' -L --exclude '__-__)
|
@@ -166,8 +233,6 @@ module Simp::BeakerHelpers
|
|
166
233
|
|
167
234
|
# use the `puppet fact` face to look up facts on an SUT
|
168
235
|
def pfact_on(sut, fact_name)
|
169
|
-
require 'ostruct'
|
170
|
-
|
171
236
|
found_fact = nil
|
172
237
|
# If puppet is not installed, there are no puppet facts to fetch
|
173
238
|
if sut.which('puppet').empty?
|
@@ -176,16 +241,15 @@ module Simp::BeakerHelpers
|
|
176
241
|
facts_json = nil
|
177
242
|
begin
|
178
243
|
cmd_output = on(sut, 'facter -p --json', :silent => true)
|
179
|
-
|
180
244
|
# Facter 4+
|
181
245
|
raise('skip facter -p') if (cmd_output.stderr =~ /no longer supported/)
|
182
246
|
|
183
|
-
facts = JSON.parse(cmd_output.stdout
|
247
|
+
facts = JSON.parse(cmd_output.stdout)
|
184
248
|
rescue StandardError
|
185
249
|
# If *anything* fails, we need to fall back to `puppet facts`
|
186
250
|
|
187
251
|
facts_json = on(sut, 'puppet facts find garbage_xxx', :silent => true).stdout
|
188
|
-
facts = JSON.parse(facts_json
|
252
|
+
facts = JSON.parse(facts_json)['values']
|
189
253
|
end
|
190
254
|
|
191
255
|
found_fact = facts.dig(*(fact_name.split('.')))
|
@@ -437,13 +501,16 @@ module Simp::BeakerHelpers
|
|
437
501
|
|
438
502
|
fips_enable_modulepath = '--modulepath=/root/.beaker_fips/modules'
|
439
503
|
|
440
|
-
|
504
|
+
modules_to_install = {
|
505
|
+
'simp-fips' => ENV['BEAKER_fips_module_version'],
|
506
|
+
'simp-crypto_policy' => nil
|
507
|
+
}
|
441
508
|
|
442
|
-
|
443
|
-
module_install_cmd
|
509
|
+
modules_to_install.each_pair do |to_install, version|
|
510
|
+
module_install_cmd = "puppet module install #{to_install} --target-dir=/root/.beaker_fips/modules"
|
511
|
+
module_install_cmd += " --version #{version}" if version
|
512
|
+
on(sut, module_install_cmd)
|
444
513
|
end
|
445
|
-
|
446
|
-
on(sut, module_install_cmd)
|
447
514
|
end
|
448
515
|
|
449
516
|
# Work around Vagrant and cipher restrictions in EL8+
|
@@ -472,7 +539,7 @@ module Simp::BeakerHelpers
|
|
472
539
|
block_on(suts, :run_in_parallel => parallel) do |sut|
|
473
540
|
if sut['yum_repos']
|
474
541
|
sut['yum_repos'].each_pair do |repo, metadata|
|
475
|
-
repo_manifest = create_yum_resource(
|
542
|
+
repo_manifest = create_yum_resource(repo, metadata)
|
476
543
|
|
477
544
|
apply_manifest_on(sut, repo_manifest, :catch_failures => true)
|
478
545
|
end
|
@@ -552,12 +619,13 @@ module Simp::BeakerHelpers
|
|
552
619
|
def enable_epel_on(suts)
|
553
620
|
parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
|
554
621
|
block_on(suts, :run_in_parallel => parallel) do |sut|
|
555
|
-
if ONLINE
|
622
|
+
if ONLINE
|
556
623
|
os_info = fact_on(sut, 'os')
|
557
624
|
os_maj_rel = os_info['release']['major']
|
558
625
|
|
559
626
|
# This is based on the official EPEL docs https://fedoraproject.org/wiki/EPEL
|
560
|
-
|
627
|
+
case os_info['name']
|
628
|
+
when 'RedHat','CentOS'
|
561
629
|
install_latest_package_on(
|
562
630
|
sut,
|
563
631
|
'epel-release',
|
@@ -583,7 +651,11 @@ module Simp::BeakerHelpers
|
|
583
651
|
on sut, %{dnf config-manager --set-enabled powertools || dnf config-manager --set-enabled PowerTools}
|
584
652
|
end
|
585
653
|
end
|
654
|
+
when 'OracleLinux'
|
655
|
+
package_name = "oracle-epel-release-el#{os_maj_rel}"
|
656
|
+
install_latest_package_on(sut,package_name)
|
586
657
|
end
|
658
|
+
|
587
659
|
end
|
588
660
|
end
|
589
661
|
end
|
@@ -600,6 +672,9 @@ module Simp::BeakerHelpers
|
|
600
672
|
def linux_errata( suts )
|
601
673
|
parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
|
602
674
|
block_on(suts, :run_in_parallel => parallel) do |sut|
|
675
|
+
# Set the locale if not set
|
676
|
+
sut.set_env_var('LANG', 'en_US.UTF-8') unless sut.get_env_var('LANG')
|
677
|
+
|
603
678
|
# We need to be able to flip between server and client without issue
|
604
679
|
on sut, 'puppet resource group puppet gid=52'
|
605
680
|
on sut, 'puppet resource user puppet comment="Puppet" gid="52" uid="52" home="/var/lib/puppet" managehome=true'
|
@@ -675,11 +750,9 @@ module Simp::BeakerHelpers
|
|
675
750
|
if os_info['family'] == 'RedHat'
|
676
751
|
# OS-specific items
|
677
752
|
if os_info['name'] == 'RedHat'
|
678
|
-
|
679
|
-
c.before(:all) do
|
680
|
-
rhel_rhsm_subscribe(sut)
|
681
|
-
end
|
753
|
+
rhel_rhsm_subscribe(sut)
|
682
754
|
|
755
|
+
RSpec.configure do |c|
|
683
756
|
c.after(:all) do
|
684
757
|
rhel_rhsm_unsubscribe(sut)
|
685
758
|
end
|
@@ -1400,49 +1473,79 @@ module Simp::BeakerHelpers
|
|
1400
1473
|
# * 'simp-community-postgres'
|
1401
1474
|
# * 'simp-community-puppet'
|
1402
1475
|
#
|
1403
|
-
|
1476
|
+
#
|
1477
|
+
# Environment Variables:
|
1478
|
+
# * BEAKER_SIMP_install_repos
|
1479
|
+
# * 'no' => disable the capability
|
1480
|
+
# * BEAKER_SIMP_disable_repos
|
1481
|
+
# * Comma delimited list of active yum repo names to disable
|
1482
|
+
def install_simp_repos(suts, disable = [])
|
1404
1483
|
# NOTE: Do *NOT* use puppet in this method since it may not be available yet
|
1405
1484
|
|
1406
|
-
|
1407
|
-
install_latest_package_on(
|
1408
|
-
sut,
|
1409
|
-
'simp-release-community',
|
1410
|
-
"https://download.simp-project.com/simp-release-community.rpm",
|
1411
|
-
)
|
1485
|
+
return if (ENV.fetch('SIMP_install_repos', 'yes') == 'no')
|
1412
1486
|
|
1413
|
-
|
1487
|
+
parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
|
1488
|
+
block_on(suts, :run_in_parallel => parallel) do |sut|
|
1489
|
+
install_package_unless_present_on(sut, 'yum-utils')
|
1414
1490
|
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1491
|
+
install_package_unless_present_on(
|
1492
|
+
sut,
|
1493
|
+
'simp-release-community',
|
1494
|
+
"https://download.simp-project.com/simp-release-community.rpm",
|
1495
|
+
)
|
1420
1496
|
|
1421
|
-
|
1422
|
-
|
1423
|
-
to_disable << 'simp-community-epel'
|
1424
|
-
to_disable << 'simp-community-postgres'
|
1425
|
-
to_disable << 'simp-community-puppet'
|
1426
|
-
end
|
1497
|
+
to_disable = disable.dup
|
1498
|
+
to_disable += ENV.fetch('BEAKER_SIMP_disable_repos', '').split(',').map(&:strip)
|
1427
1499
|
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
# have the '--dump' option.
|
1434
|
-
available_repos = on(sut, %{yum-config-manager --enablerepo="*" || yum-config-manager --enablerepo="*" --dump}).stdout.lines.grep(/\A\[(.+)\]\Z/){|x| $1}
|
1500
|
+
unless to_disable.empty?
|
1501
|
+
if to_disable.include?('simp')
|
1502
|
+
to_disable.delete('simp')
|
1503
|
+
to_disable << 'simp-community-simp'
|
1504
|
+
end
|
1435
1505
|
|
1436
|
-
|
1506
|
+
if to_disable.include?('simp_deps')
|
1507
|
+
to_disable.delete('simp_deps')
|
1508
|
+
to_disable << 'simp-community-epel'
|
1509
|
+
to_disable << 'simp-community-postgres'
|
1510
|
+
to_disable << 'simp-community-puppet'
|
1511
|
+
end
|
1437
1512
|
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1513
|
+
# NOTE: This --enablerepo enables the repos for listing and is inherited
|
1514
|
+
# from YUM. This does not actually "enable" the repos, that would require
|
1515
|
+
# the "--enable" option (from yum-config-manager) :-D.
|
1516
|
+
#
|
1517
|
+
# Note: Certain versions of EL8 do not dump by default and EL7 does not
|
1518
|
+
# have the '--dump' option.
|
1519
|
+
available_repos = on(sut, %{yum-config-manager --enablerepo="*" || yum-config-manager --enablerepo="*" --dump}).stdout.lines.grep(/\A\[(.+)\]\Z/){|x| $1}
|
1520
|
+
|
1521
|
+
invalid_repos = (to_disable - available_repos)
|
1442
1522
|
|
1443
|
-
|
1444
|
-
|
1523
|
+
# Verify that the repos passed to disable are in the list of valid repos
|
1524
|
+
unless invalid_repos.empty?
|
1525
|
+
logger.warn(%{WARN: install_simp_repo - requested repos to disable do not exist on the target system '#{invalid_repos.join("', '")}'.})
|
1526
|
+
end
|
1527
|
+
|
1528
|
+
(to_disable - invalid_repos).each do |repo|
|
1529
|
+
on(sut, %{yum-config-manager --disable "#{repo}"})
|
1530
|
+
end
|
1445
1531
|
end
|
1446
1532
|
end
|
1533
|
+
|
1534
|
+
set_yum_opts_on(suts, {'simp*.skip_if_unavailable' => '1' })
|
1535
|
+
end
|
1536
|
+
|
1537
|
+
# Set the release and release type of the SIMP yum repos
|
1538
|
+
#
|
1539
|
+
# Environment variables may be used to set either one
|
1540
|
+
# * BEAKER_SIMP_repo_release => The actual release (version number)
|
1541
|
+
# * BEAKER_SIMP_repo_release_type => The type of release (stable, unstable, rolling, etc...)
|
1542
|
+
def set_simp_repo_release(sut, simp_release_type='stable', simp_release='6')
|
1543
|
+
simp_release = ENV.fetch('BEAKER_SIMP_repo_release', simp_release)
|
1544
|
+
simp_release_type = ENV.fetch('BEAKER_SIMP_repo_release_type', simp_release_type)
|
1545
|
+
|
1546
|
+
simp_release_type = 'releases' if (simp_release_type == 'stable')
|
1547
|
+
|
1548
|
+
create_remote_file(sut, '/etc/yum/vars/simprelease', simp_release)
|
1549
|
+
create_remote_file(sut, '/etc/yum/vars/simpreleasetype', simp_release_type)
|
1447
1550
|
end
|
1448
1551
|
end
|