foreman_maintain 0.1.6 → 0.2.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/README.md +48 -10
- data/bin/foreman-maintain-rotate-tar +18 -0
- data/definitions/checks/backup/certs_tar_exist.rb +24 -0
- data/definitions/checks/backup/directory_ready.rb +21 -0
- data/definitions/checks/candlepin/db_up.rb +29 -0
- data/definitions/checks/check_epel_repository.rb +21 -0
- data/definitions/checks/foreman/db_up.rb +29 -0
- data/definitions/checks/hammer_ping.rb +3 -1
- data/definitions/checks/mongo/db_up.rb +29 -0
- data/definitions/checks/mongo/tools_installed.rb +31 -0
- data/definitions/checks/repositories/validate.rb +0 -3
- data/definitions/checks/root_user.rb +12 -0
- data/definitions/features/candlepin.rb +16 -0
- data/definitions/features/candlepin_database.rb +3 -1
- data/definitions/features/downstream.rb +21 -22
- data/definitions/features/foreman_database.rb +2 -0
- data/definitions/features/foreman_proxy.rb +70 -7
- data/definitions/features/foreman_server.rb +29 -0
- data/definitions/features/foreman_tasks.rb +5 -1
- data/definitions/features/hammer.rb +158 -3
- data/definitions/features/installer.rb +106 -0
- data/definitions/features/instance.rb +39 -0
- data/definitions/features/katello.rb +43 -0
- data/definitions/features/mongo.rb +159 -0
- data/definitions/features/pulp.rb +30 -0
- data/definitions/features/puppet.rb +21 -0
- data/definitions/features/puppet_server.rb +2 -6
- data/definitions/features/service.rb +134 -0
- data/definitions/features/sync_plans.rb +1 -1
- data/definitions/features/tar.rb +69 -0
- data/definitions/procedures/backup/accessibility_confirmation.rb +14 -0
- data/definitions/procedures/backup/clean.rb +16 -0
- data/definitions/procedures/backup/compress_data.rb +26 -0
- data/definitions/procedures/backup/config_files.rb +36 -0
- data/definitions/procedures/backup/metadata.rb +56 -0
- data/definitions/procedures/backup/offline/candlepin_db.rb +57 -0
- data/definitions/procedures/backup/offline/foreman_db.rb +57 -0
- data/definitions/procedures/backup/offline/mongo.rb +56 -0
- data/definitions/procedures/backup/online/candlepin_db.rb +20 -0
- data/definitions/procedures/backup/online/foreman_db.rb +20 -0
- data/definitions/procedures/backup/online/mongo.rb +21 -0
- data/definitions/procedures/backup/online/pg_global_objects.rb +23 -0
- data/definitions/procedures/backup/online/safety_confirmation.rb +25 -0
- data/definitions/procedures/backup/prepare_directory.rb +29 -0
- data/definitions/procedures/backup/pulp.rb +68 -0
- data/definitions/procedures/backup/snapshot/clean_mount.rb +24 -0
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +47 -0
- data/definitions/procedures/backup/snapshot/mount_base.rb +27 -0
- data/definitions/procedures/backup/snapshot/mount_candlepin_db.rb +48 -0
- data/definitions/procedures/backup/snapshot/mount_foreman_db.rb +48 -0
- data/definitions/procedures/backup/snapshot/mount_mongo.rb +35 -0
- data/definitions/procedures/backup/snapshot/mount_pulp.rb +24 -0
- data/definitions/procedures/backup/snapshot/prepare_mount.rb +16 -0
- data/definitions/procedures/foreman_tasks/fetch_tasks_status.rb +1 -0
- data/definitions/procedures/hammer_setup.rb +4 -39
- data/definitions/procedures/installer/upgrade.rb +1 -21
- data/definitions/procedures/repositories/setup.rb +0 -4
- data/definitions/procedures/service/base.rb +31 -0
- data/definitions/procedures/service/disable.rb +14 -0
- data/definitions/procedures/service/enable.rb +14 -0
- data/definitions/procedures/service/list.rb +26 -0
- data/definitions/procedures/service/restart.rb +49 -0
- data/definitions/procedures/service/start.rb +14 -0
- data/definitions/procedures/service/status.rb +14 -0
- data/definitions/procedures/service/stop.rb +14 -0
- data/definitions/scenarios/backup.rb +242 -0
- data/definitions/scenarios/services.rb +156 -0
- data/definitions/scenarios/upgrade_to_satellite_6_2.rb +2 -2
- data/definitions/scenarios/upgrade_to_satellite_6_2_z.rb +2 -2
- data/definitions/scenarios/upgrade_to_satellite_6_3.rb +2 -2
- data/definitions/scenarios/upgrade_to_satellite_6_3_z.rb +2 -2
- data/definitions/scenarios/upgrade_to_satellite_6_4.rb +79 -0
- data/definitions/scenarios/upgrade_to_satellite_6_4_z.rb +79 -0
- data/lib/foreman_maintain.rb +5 -0
- data/lib/foreman_maintain/cli.rb +4 -0
- data/lib/foreman_maintain/cli/backup_command.rb +157 -0
- data/lib/foreman_maintain/cli/base.rb +18 -8
- data/lib/foreman_maintain/cli/service_command.rb +112 -0
- data/lib/foreman_maintain/cli/transform_clamp_options.rb +1 -1
- data/lib/foreman_maintain/concerns/base_database.rb +57 -5
- data/lib/foreman_maintain/concerns/hammer.rb +0 -9
- data/lib/foreman_maintain/concerns/metadata.rb +3 -1
- data/lib/foreman_maintain/concerns/reporter.rb +12 -0
- data/lib/foreman_maintain/concerns/system_helpers.rb +45 -2
- data/lib/foreman_maintain/detector.rb +3 -3
- data/lib/foreman_maintain/error.rb +12 -0
- data/lib/foreman_maintain/executable.rb +29 -6
- data/lib/foreman_maintain/feature.rb +15 -0
- data/lib/foreman_maintain/param.rb +4 -3
- data/lib/foreman_maintain/reporter.rb +6 -2
- data/lib/foreman_maintain/reporter/cli_reporter.rb +26 -10
- data/lib/foreman_maintain/runner.rb +26 -15
- data/lib/foreman_maintain/runner/execution.rb +5 -1
- data/lib/foreman_maintain/scenario.rb +11 -3
- data/lib/foreman_maintain/upgrade_runner.rb +0 -2
- data/lib/foreman_maintain/utils.rb +2 -2
- data/lib/foreman_maintain/utils/command_runner.rb +0 -2
- data/lib/foreman_maintain/utils/hash_tools.rb +21 -0
- data/lib/foreman_maintain/utils/mongo_core.rb +37 -0
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +58 -8
- data/definitions/features/katello_service.rb +0 -118
- data/definitions/procedures/katello_service/restart.rb +0 -24
- data/definitions/procedures/katello_service/start.rb +0 -19
- data/definitions/procedures/katello_service/stop.rb +0 -17
- data/lib/foreman_maintain/utils/facter.rb +0 -21
- data/lib/foreman_maintain/utils/hammer.rb +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a95032534af5a5f6533cf1b1623321f71462bd98
|
4
|
+
data.tar.gz: 9fbc367b8ea5dfbf01112d614123661921b146f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41f25e7065a7752525906ab02073c1af43a426ea450c68ca91b03c8ded84e9c55bd0f129166ecfd7b3bc7dfb9a870b54ad9f307bcaeb14b33e154d588e35c480
|
7
|
+
data.tar.gz: 7894e033e22c4c378afc3d4aafac9ae53279409f1796e05099e391b250cf9ed825bb5453749fc59e385da1eda18993a4bdc31c8dd120067204619396104639e5
|
data/README.md
CHANGED
@@ -21,6 +21,20 @@ Subcommands:
|
|
21
21
|
check --target-version TARGET_VERSION Run pre-upgrade checks for upgrading to specified version
|
22
22
|
run --target-version TARGET_VERSION Run the full upgrade
|
23
23
|
[--phase=phase TARGET_VERSION] Run just a specific phase of the upgrade
|
24
|
+
|
25
|
+
advanced Advanced tools for server maintenance
|
26
|
+
procedure Run maintain procedures manually
|
27
|
+
run Run maintain procedures manually
|
28
|
+
by-tag Run maintain procedures in bulks
|
29
|
+
|
30
|
+
service Control applicable services
|
31
|
+
start Start applicable services
|
32
|
+
stop Stop applicable services
|
33
|
+
restart Restart applicable services
|
34
|
+
status Get statuses of applicable services
|
35
|
+
list List applicable services
|
36
|
+
enable Enable applicable services
|
37
|
+
disable Disable applicable services
|
24
38
|
```
|
25
39
|
|
26
40
|
### Upgrades
|
@@ -283,24 +297,48 @@ end
|
|
283
297
|
### Hammer
|
284
298
|
|
285
299
|
In some cases, it's useful to be able to use the hammer as part of check/fix procedures.
|
286
|
-
|
300
|
+
It is as simple as:
|
287
301
|
|
288
302
|
```ruby
|
289
|
-
include ForemanMaintain::Concerns::Hammer
|
290
|
-
|
291
303
|
def run
|
292
|
-
hammer('task resume')
|
304
|
+
feature(:hammer).run('task resume')
|
293
305
|
end
|
294
306
|
```
|
295
307
|
|
296
|
-
|
308
|
+
Before executing the command the feature checks if it has valid hammer configuration to run the command.
|
309
|
+
Foreman maintain always use the 'admin' account to run the commands. The password is taken either form
|
310
|
+
the Hammer config or installer answer files or asked from the user interactively (in this order).
|
311
|
+
The valid credentials are stored and reused next time if still valid.
|
297
312
|
|
313
|
+
Usually we want to do the user interaction at the beginning of our scenario.
|
314
|
+
The easiest way to achieve this is to include `ForemanMaintain::Concerns::Hammer` module:
|
315
|
+
|
316
|
+
```ruby
|
317
|
+
include ForemanMaintain::Concerns::Hammer
|
298
318
|
```
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
319
|
+
|
320
|
+
which adds `Procedures::HammerSetup` as a preparation step to your metadata. We are adding this
|
321
|
+
to all procedures and checks automatically.
|
322
|
+
|
323
|
+
## Metadata
|
324
|
+
|
325
|
+
A set of data that describes and gives information about any definition.
|
326
|
+
|
327
|
+
You can describe a definition using following methods available in metadata:
|
328
|
+
|
329
|
+
* **label** - specify an unique name per definition
|
330
|
+
* **tags** - comma separated labels attached for the purpose of creating
|
331
|
+
groups of definitions
|
332
|
+
* **description** - specify short description about definition
|
333
|
+
* **param** - declare parameters for a definition using this method
|
334
|
+
* **for_feature** - specify feature name for a definition. It implicitly confines the presence
|
335
|
+
of that feature.
|
336
|
+
* **preparation_steps** - takes block using which you can perform additional steps
|
337
|
+
before executing actual definition
|
338
|
+
* **confine** - takes block as argument to restrict execution of it
|
339
|
+
* **advanced_run** - takes a boolean value for procedure definition & will restrict
|
340
|
+
execution of procedure from `advanced procedure run` sub-command
|
341
|
+
* **before**, **after** - methods used to define order for particular check. Specify label of other check.
|
304
342
|
|
305
343
|
## Implementation components
|
306
344
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
## For this script it's advisable to use a shell, such as Bash,
|
3
|
+
## that supports a TAR_FD value greater than 9.
|
4
|
+
|
5
|
+
# This script taken from the tar info doc
|
6
|
+
|
7
|
+
name=`expr ${TAR_ARCHIVE} : '\(.*\)\..*'`
|
8
|
+
volnum=`printf "%04d" ${TAR_VOLUME}`
|
9
|
+
filename="${name:-$TAR_ARCHIVE}.part${volnum:-$TAR_VOLUME}"
|
10
|
+
case ${TAR_SUBCOMMAND} in
|
11
|
+
-c) ;;
|
12
|
+
-d|-x|-t) test -r ${filename} || exit 1
|
13
|
+
;;
|
14
|
+
*) exit 1
|
15
|
+
esac
|
16
|
+
|
17
|
+
echo ${filename} >&${TAR_FD}
|
18
|
+
echo " Switched to multi-volume ${filename}"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Checks::Backup
|
2
|
+
class CertsTarExist < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
description 'Check if proxy certs_tar exist'
|
5
|
+
tags :backup
|
6
|
+
for_feature :foreman_proxy
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
unless feature(:foreman_proxy).internal?
|
11
|
+
if certs_tar && !File.exist?(certs_tar)
|
12
|
+
name = feature(:instance).proxy_product_name
|
13
|
+
fail! "#{name} certs tar file is not present on the system" \
|
14
|
+
" in path '#{certs_tar}'. \nPlease move the file back to that" \
|
15
|
+
' location or generate a new one on the main server.'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def certs_tar
|
21
|
+
feature(:foreman_proxy).certs_tar
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Checks::Backup
|
2
|
+
class DirectoryReady < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
description 'Check if the directory exists and is writable'
|
5
|
+
tags :backup
|
6
|
+
manual_detection
|
7
|
+
param :backup_dir, 'Directory where to backup to', :required => true
|
8
|
+
param :preserve_dir, 'Directory where to backup to', :flag => true, :default => false
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
assert(File.directory?(@backup_dir), "Backup directory (#{@backup_dir}) does not exit.")
|
13
|
+
if local_psql_database?
|
14
|
+
result = system("runuser - postgres -c 'test -w #{@backup_dir}'")
|
15
|
+
assert(result, "Postgres user needs write access to the backup directory \n" \
|
16
|
+
"Please allow the postgres user write access to #{@backup_dir}" \
|
17
|
+
' or choose another directory.')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Checks
|
2
|
+
module Candlepin
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure Candlepin DB is up'
|
6
|
+
label :candlepin_db_up
|
7
|
+
for_feature :candlepin_database
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
with_spinner('Checking connection to the Candlepin DB') do
|
13
|
+
status = feature(:candlepin_database).ping
|
14
|
+
end
|
15
|
+
assert(status, 'Candlepin DB is not responding. ' \
|
16
|
+
'It needs to be up and running to perform the following steps',
|
17
|
+
:next_steps => next_steps)
|
18
|
+
end
|
19
|
+
|
20
|
+
def next_steps
|
21
|
+
if feature(:foreman_database).local?
|
22
|
+
[Procedures::Service::Start.new(:only => 'postgresql')]
|
23
|
+
else
|
24
|
+
[] # there is nothing we can do for remote db
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Checks::CheckEpelRepository < ForemanMaintain::Check
|
2
|
+
metadata do
|
3
|
+
label :check_epel_repository
|
4
|
+
description 'Check if EPEL repository enabled on system'
|
5
|
+
tags :pre_upgrade
|
6
|
+
confine do
|
7
|
+
feature(:downstream)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
with_spinner('Checking for presence of EPEL repository') do
|
13
|
+
assert(!epel_enabled?, 'System is subscribed to EPEL repository')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def epel_enabled?
|
18
|
+
system_repos = execute("yum repolist enabled -d 6 -e 0| grep -E 'Repo-baseurl|Repo-id'")
|
19
|
+
system_repos.to_s.match(/\bepel\b/i)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Checks
|
2
|
+
module Foreman
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure Foreman DB is up'
|
6
|
+
label :foreman_db_up
|
7
|
+
for_feature :foreman_database
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
with_spinner('Checking connection to the Foreman DB') do
|
13
|
+
status = feature(:foreman_database).ping
|
14
|
+
end
|
15
|
+
assert(status, 'Foreman DB is not responding. ' \
|
16
|
+
'It needs to be up and running to perform the following steps',
|
17
|
+
:next_steps => next_steps)
|
18
|
+
end
|
19
|
+
|
20
|
+
def next_steps
|
21
|
+
if feature(:foreman_database).local?
|
22
|
+
[Procedures::Service::Start.new(:only => 'postgresql')]
|
23
|
+
else
|
24
|
+
[] # there is nothing we can do for remote db
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -13,8 +13,10 @@ class Checks::HammerPing < ForemanMaintain::Check
|
|
13
13
|
|
14
14
|
def run
|
15
15
|
result = feature(:hammer).hammer_ping_cmd
|
16
|
+
restart_procedure = Procedures::Service::Restart.new(:only => result[:data],
|
17
|
+
:wait_for_hammer_ping => true)
|
16
18
|
assert(result[:success],
|
17
19
|
result[:message],
|
18
|
-
:next_steps =>
|
20
|
+
:next_steps => restart_procedure)
|
19
21
|
end
|
20
22
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Checks
|
2
|
+
module Mongo
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure Mongo DB is up'
|
6
|
+
label :mongo_db_up
|
7
|
+
for_feature :mongo
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
with_spinner('Checking connection to the Mongo DB') do
|
13
|
+
status = feature(:mongo).ping
|
14
|
+
end
|
15
|
+
assert(status, 'Mongo DB is not responding. ' \
|
16
|
+
'It needs to be up and running to perform the following steps.',
|
17
|
+
:next_steps => next_steps)
|
18
|
+
end
|
19
|
+
|
20
|
+
def next_steps
|
21
|
+
if feature(:mongo).local?
|
22
|
+
[Procedures::Service::Start.new(:only => 'mongod')]
|
23
|
+
else
|
24
|
+
[] # there is nothing we can do for remote db
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Checks::Mongo
|
2
|
+
class ToolsInstalled < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
manual_detection
|
5
|
+
description 'Checks whether the tools for Mongo DB are installed'
|
6
|
+
for_feature :mongo
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
if feature(:mongo).server_version =~ /^3\.4/
|
11
|
+
tools_pkg = 'rh-mongodb34-mongo-tools'
|
12
|
+
result = find_package(tools_pkg)
|
13
|
+
else
|
14
|
+
result = execute?('which mongodump')
|
15
|
+
tools_pkg = 'mongodb'
|
16
|
+
end
|
17
|
+
handle_result(result, tools_pkg)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def handle_result(result, tools_pkg)
|
23
|
+
assert(result,
|
24
|
+
"#{tools_pkg} was not found among installed package.\nThis package is needed to " \
|
25
|
+
'do various operations such as backup, restore and import with Mongo DB.',
|
26
|
+
:next_steps => [
|
27
|
+
Procedures::Packages::Install.new(:packages => [tools_pkg])
|
28
|
+
])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -2,9 +2,6 @@ module Checks::Repositories
|
|
2
2
|
class Validate < ForemanMaintain::Check
|
3
3
|
metadata do
|
4
4
|
description 'Validate availability of repositories'
|
5
|
-
preparation_steps do
|
6
|
-
Procedures::Packages::Install.new(:packages => [ForemanMaintain::Utils::Facter.package])
|
7
|
-
end
|
8
5
|
|
9
6
|
confine do
|
10
7
|
feature(:downstream)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Checks::RootUser < ForemanMaintain::Check
|
2
|
+
metadata do
|
3
|
+
label :root_user
|
4
|
+
tags :root_user
|
5
|
+
description 'Check if command is run as root user'
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
is_root_user = Process.uid == 0
|
10
|
+
assert(is_root_user, 'This command needs to be run as the root user')
|
11
|
+
end
|
12
|
+
end
|
@@ -48,13 +48,15 @@ class Features::CandlepinDatabase < ForemanMaintain::Feature
|
|
48
48
|
def load_configuration
|
49
49
|
raw_config = File.read(CANDLEPIN_DB_CONFIG)
|
50
50
|
full_config = Hash[raw_config.scan(/(^[^#\n][^=]*)=(.*)/)]
|
51
|
-
|
51
|
+
uri_regexp = %r{://(([^/:]*):?([^/]*))/([^?]*)\??(ssl=([^&]*))?}
|
52
|
+
uri = uri_regexp.match(full_config['jpa.config.hibernate.connection.url'])
|
52
53
|
@configuration = {
|
53
54
|
'username' => full_config['jpa.config.hibernate.connection.username'],
|
54
55
|
'password' => full_config['jpa.config.hibernate.connection.password'],
|
55
56
|
'database' => uri[4],
|
56
57
|
'host' => uri[2],
|
57
58
|
'port' => uri[3] || '5432',
|
59
|
+
'ssl' => (uri[6] == 'true'),
|
58
60
|
'driver_class' => full_config['jpa.config.hibernate.connection.driver_class'],
|
59
61
|
'url' => full_config['jpa.config.hibernate.connection.url']
|
60
62
|
}
|
@@ -7,6 +7,14 @@ class Features::Downstream < ForemanMaintain::Feature
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
def less_than_version?(version)
|
11
|
+
Gem::Version.new(current_version) < Gem::Version.new(version)
|
12
|
+
end
|
13
|
+
|
14
|
+
def at_least_version?(version)
|
15
|
+
Gem::Version.new(current_version) >= Gem::Version.new(version)
|
16
|
+
end
|
17
|
+
|
10
18
|
def current_version
|
11
19
|
@current_version ||= rpm_version('satellite') || version_from_source
|
12
20
|
end
|
@@ -46,32 +54,23 @@ class Features::Downstream < ForemanMaintain::Feature
|
|
46
54
|
|
47
55
|
def rh_repos(sat_version)
|
48
56
|
sat_version = version(sat_version)
|
49
|
-
rh_version_major =
|
50
|
-
|
51
|
-
rh_repos = main_rh_repos(rh_version_major)
|
52
|
-
|
53
|
-
rh_repos.concat(sat_and_tools_repos(rh_version_major, sat_version))
|
54
|
-
|
55
|
-
if current_minor_version == '6.3' && sat_version.to_s != '6.4' && (
|
56
|
-
feature(:puppet_server) && feature(:puppet_server).puppet_version.major == 4)
|
57
|
-
rh_repos << "rhel-#{rh_version_major}-server-satellite-tools-6.3-puppet4-rpms"
|
58
|
-
end
|
59
|
-
|
60
|
-
rh_repos
|
61
|
-
end
|
62
|
-
|
63
|
-
def sat_and_tools_repos(rh_version_major, sat_version)
|
57
|
+
rh_version_major = execute!('facter operatingsystemmajrelease')
|
64
58
|
sat_version_full = "#{sat_version.major}.#{sat_version.minor}"
|
59
|
+
|
65
60
|
sat_repo_id = "rhel-#{rh_version_major}-server-satellite-#{sat_version_full}-rpms"
|
66
61
|
sat_tools_repo_id = "rhel-#{rh_version_major}-server-satellite-tools-#{sat_version_full}-rpms"
|
62
|
+
# Override to use Beta repositories for 6.4 until GA
|
63
|
+
if sat_version.to_s == '6.4'
|
64
|
+
sat_repo_id = "rhel-server-#{rh_version_major}-satellite-6-beta-rpms"
|
65
|
+
end
|
67
66
|
|
68
|
-
[
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
67
|
+
rh_repos = ["rhel-#{rh_version_major}-server-rpms",
|
68
|
+
"rhel-server-rhscl-#{rh_version_major}-rpms",
|
69
|
+
"rhel-#{rh_version_major}-server-satellite-maintenance-6-rpms",
|
70
|
+
sat_tools_repo_id,
|
71
|
+
sat_repo_id]
|
72
|
+
rh_repos << 'rhel-7-server-ansible-2-rpms' if sat_version.to_s == '6.4'
|
73
|
+
rh_repos
|
75
74
|
end
|
76
75
|
|
77
76
|
def version_from_source
|