foreman_maintain 1.6.9 → 1.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/checks/foreman/validate_external_db_version.rb +3 -3
- data/definitions/features/capsule.rb +4 -0
- data/definitions/features/katello.rb +0 -4
- data/definitions/features/satellite.rb +4 -0
- data/definitions/procedures/backup/prepare_directory.rb +17 -5
- data/definitions/procedures/hammer_setup.rb +5 -1
- data/definitions/procedures/packages/update_all_confirmation.rb +12 -5
- data/definitions/procedures/pulpcore/container_handle_image_metadata.rb +0 -3
- data/definitions/procedures/repositories/index_katello_repositories_container_metadata.rb +17 -0
- data/definitions/scenarios/backup.rb +3 -5
- data/definitions/scenarios/foreman_upgrade.rb +2 -1
- data/definitions/scenarios/satellite_upgrade.rb +3 -2
- data/lib/foreman_maintain/update_runner.rb +1 -1
- data/lib/foreman_maintain/version.rb +1 -1
- data/lib/foreman_maintain.rb +4 -0
- metadata +3 -3
- data/definitions/procedures/restore/postgres_owner.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 251038c33fba4faa2abf9c839937e229a664703c9b3003376b4d88aa7eca7d02
|
4
|
+
data.tar.gz: 72f4bb7fe9e7a9862df58accbfa190019a3356e99917d884242ad90259743291
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 140782d6ee833f07a64b2310fd94901f42991dc9babb2368cdc48c904fe78122c6e8ae6584bdb7c2818883e6c425035288d9f2859b7983d5957a5366c7c1a13a
|
7
|
+
data.tar.gz: 127c879d335e5dc46151d31e02d9fb72c4f45bcaff5ffcd83dee2ae1552877952a2b7128b28e45c69cab779df7055025e9bfdfa014bc484ae17ef2ffdd595ad3
|
@@ -12,15 +12,15 @@ module Checks
|
|
12
12
|
|
13
13
|
def run
|
14
14
|
current_db_version = feature(:foreman_database).db_version
|
15
|
-
fail!(db_upgrade_message(current_db_version)) if current_db_version.major <
|
15
|
+
fail!(db_upgrade_message(current_db_version)) if current_db_version.major < 13
|
16
16
|
end
|
17
17
|
|
18
18
|
def db_upgrade_message(db_version)
|
19
19
|
product_name = feature(:instance).product_name
|
20
20
|
|
21
21
|
"\n\n*** ERROR: Server is running on PostgreSQL #{db_version} database.\n"\
|
22
|
-
"*** Newer version of #{product_name} supports only PostgreSQL version
|
23
|
-
"*** Before proceeding further, you must upgrade database to PostgreSQL
|
22
|
+
"*** Newer version of #{product_name} supports only PostgreSQL version 13.\n"\
|
23
|
+
"*** Before proceeding further, you must upgrade database to PostgreSQL 13.\n"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -6,18 +6,29 @@ module Procedures::Backup
|
|
6
6
|
param :backup_dir, 'Directory where to backup to', :required => true
|
7
7
|
param :preserve_dir, 'Directory where to backup to', :flag => true
|
8
8
|
param :incremental_dir, 'Changes since specified backup only'
|
9
|
+
param :online_backup, 'Select for online backup', :flag => true, :default => false
|
9
10
|
end
|
10
11
|
|
12
|
+
# rubocop:disable Metrics/MethodLength
|
11
13
|
def run
|
12
|
-
puts "Creating backup folder #{@backup_dir}"
|
13
|
-
|
14
14
|
unless @preserve_dir
|
15
|
+
puts "Creating backup folder #{@backup_dir}"
|
16
|
+
|
15
17
|
FileUtils.mkdir_p @backup_dir
|
16
18
|
FileUtils.chmod_R 0o770, @backup_dir
|
17
|
-
end
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
if feature(:instance).postgresql_local? && @online_backup
|
21
|
+
begin
|
22
|
+
FileUtils.chown_R(nil, 'postgres', @backup_dir)
|
23
|
+
rescue Errno::EPERM
|
24
|
+
warn_msg = <<~MSG
|
25
|
+
#{@backup_dir} could not be made readable by the 'postgres' user.
|
26
|
+
This won't affect the backup procedure, but you have to ensure that
|
27
|
+
the 'postgres' user can read the data during restore.
|
28
|
+
MSG
|
29
|
+
set_status(:warning, warn_msg)
|
30
|
+
end
|
31
|
+
end
|
21
32
|
end
|
22
33
|
|
23
34
|
FileUtils.rm(Dir.glob(File.join(@backup_dir, '.*.snar'))) if @preserve_dir
|
@@ -30,5 +41,6 @@ module Procedures::Backup
|
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
44
|
+
# rubocop:enable Metrics/MethodLength
|
33
45
|
end
|
34
46
|
end
|
@@ -8,11 +8,18 @@ module Procedures::Packages
|
|
8
8
|
|
9
9
|
def run
|
10
10
|
if @packages.nil? || @packages.empty?
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
command = ForemanMaintain.command_name
|
12
|
+
|
13
|
+
question = <<~MSG
|
14
|
+
WARNING: No specific packages to update were provided
|
15
|
+
so we are going to update all available packages. We
|
16
|
+
recommend using the update command to update to a minor
|
17
|
+
version and/or operating system using '#{command} update'.
|
18
|
+
To upgrade to the next #{feature(:instance).product_name} version use '#{command} upgrade'.
|
19
|
+
Do you want to proceed with update of everything regardless of
|
20
|
+
the recommendations?
|
21
|
+
MSG
|
22
|
+
|
16
23
|
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
|
17
24
|
abort! unless answer == :yes
|
18
25
|
end
|
@@ -17,9 +17,6 @@ module Procedures::Pulpcore
|
|
17
17
|
spinner.update('Adding image metadata to pulp. You can continue using the ' \
|
18
18
|
'system normally while the task runs in the background.')
|
19
19
|
execute!(pulpcore_manager('container-handle-image-data'))
|
20
|
-
spinner.update('Adding image metadata to katello. You can continue using the ' \
|
21
|
-
'system normally while the task runs in the background.')
|
22
|
-
execute!('foreman-rake katello:import_container_manifest_labels')
|
23
20
|
end
|
24
21
|
end
|
25
22
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Procedures::Repositories
|
2
|
+
class IndexKatelloRepositoriesContainerMetatdata < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Import container manifest metadata'
|
5
|
+
confine do
|
6
|
+
feature(:katello)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
with_spinner(('Adding image metadata. You can continue using the ' \
|
12
|
+
'system normally while the task runs in the background.')) do
|
13
|
+
execute!('foreman-rake katello:import_container_manifest_labels')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -20,7 +20,8 @@ module ForemanMaintain::Scenarios
|
|
20
20
|
check_valid_strategy
|
21
21
|
safety_confirmation
|
22
22
|
add_step_with_context(Procedures::Backup::AccessibilityConfirmation) if strategy == :offline
|
23
|
-
add_step_with_context(Procedures::Backup::PrepareDirectory
|
23
|
+
add_step_with_context(Procedures::Backup::PrepareDirectory,
|
24
|
+
:online_backup => strategy == :online)
|
24
25
|
add_step_with_context(Procedures::Backup::Metadata, :online_backup => strategy == :online)
|
25
26
|
|
26
27
|
case strategy
|
@@ -81,15 +82,13 @@ module ForemanMaintain::Scenarios
|
|
81
82
|
include_dumps if include_db_dumps?
|
82
83
|
add_step_with_context(Procedures::ForemanProxy::Features, :load_only => true)
|
83
84
|
add_steps_with_context(
|
84
|
-
find_procedures(:maintenance_mode_on),
|
85
85
|
Procedures::Service::Stop,
|
86
86
|
Procedures::Backup::ConfigFiles,
|
87
87
|
Procedures::Backup::Pulp,
|
88
88
|
Procedures::Backup::Offline::CandlepinDB,
|
89
89
|
Procedures::Backup::Offline::ForemanDB,
|
90
90
|
Procedures::Backup::Offline::PulpcoreDB,
|
91
|
-
Procedures::Service::Start
|
92
|
-
find_procedures(:maintenance_mode_off)
|
91
|
+
Procedures::Service::Start
|
93
92
|
)
|
94
93
|
end
|
95
94
|
|
@@ -138,7 +137,6 @@ module ForemanMaintain::Scenarios
|
|
138
137
|
def compose
|
139
138
|
if strategy == :offline
|
140
139
|
add_step_with_context(Procedures::Service::Start)
|
141
|
-
add_steps_with_context(find_procedures(:maintenance_mode_off))
|
142
140
|
end
|
143
141
|
add_step_with_context(Procedures::Backup::Clean)
|
144
142
|
end
|
@@ -135,7 +135,8 @@ module Scenarios::ForemanUpgrade
|
|
135
135
|
Checks::ServicesUp,
|
136
136
|
Checks::SystemRegistration,
|
137
137
|
Procedures::Packages::CheckForReboot,
|
138
|
-
Procedures::Pulpcore::ContainerHandleImageMetadata
|
138
|
+
Procedures::Pulpcore::ContainerHandleImageMetadata,
|
139
|
+
Procedures::Repositories::IndexKatelloRepositoriesContainerMetatdata
|
139
140
|
)
|
140
141
|
end
|
141
142
|
end
|
@@ -4,7 +4,7 @@ module Scenarios::Satellite
|
|
4
4
|
metadata do
|
5
5
|
tags :upgrade_scenario
|
6
6
|
confine do
|
7
|
-
(feature(:
|
7
|
+
(feature(:instance).downstream&.current_minor_version == '6.15' || \
|
8
8
|
ForemanMaintain.upgrade_in_progress == '6.16')
|
9
9
|
end
|
10
10
|
instance_eval(&block)
|
@@ -60,7 +60,7 @@ module Scenarios::Satellite
|
|
60
60
|
if el8?
|
61
61
|
modules_to_switch = ['postgresql:13']
|
62
62
|
add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
|
63
|
-
modules_to_enable = ["
|
63
|
+
modules_to_enable = ["#{feature(:instance).downstream.module_name}:#{el_short_name}"]
|
64
64
|
add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
|
65
65
|
end
|
66
66
|
add_step(Procedures::Packages::Update.new(
|
@@ -99,6 +99,7 @@ module Scenarios::Satellite
|
|
99
99
|
add_steps(find_checks(:post_upgrade))
|
100
100
|
add_step(Procedures::Packages::CheckForReboot)
|
101
101
|
add_step(Procedures::Pulpcore::ContainerHandleImageMetadata)
|
102
|
+
add_step(Procedures::Repositories::IndexKatelloRepositoriesContainerMetatdata)
|
102
103
|
end
|
103
104
|
end
|
104
105
|
end
|
data/lib/foreman_maintain.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_maintain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -284,6 +284,7 @@ files:
|
|
284
284
|
- definitions/procedures/repositories/backup_enabled_repos.rb
|
285
285
|
- definitions/procedures/repositories/disable.rb
|
286
286
|
- definitions/procedures/repositories/enable.rb
|
287
|
+
- definitions/procedures/repositories/index_katello_repositories_container_metadata.rb
|
287
288
|
- definitions/procedures/repositories/setup.rb
|
288
289
|
- definitions/procedures/restore/candlepin_dump.rb
|
289
290
|
- definitions/procedures/restore/configs.rb
|
@@ -292,7 +293,6 @@ files:
|
|
292
293
|
- definitions/procedures/restore/extract_files.rb
|
293
294
|
- definitions/procedures/restore/foreman_dump.rb
|
294
295
|
- definitions/procedures/restore/installer_reset.rb
|
295
|
-
- definitions/procedures/restore/postgres_owner.rb
|
296
296
|
- definitions/procedures/restore/pulpcore_dump.rb
|
297
297
|
- definitions/procedures/restore/reindex_databases.rb
|
298
298
|
- definitions/procedures/restore/required_packages.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Procedures::Restore
|
2
|
-
class PostgresOwner < ForemanMaintain::Procedure
|
3
|
-
include ForemanMaintain::Concerns::SystemHelpers
|
4
|
-
metadata do
|
5
|
-
description 'Make postgres owner of backup directory'
|
6
|
-
|
7
|
-
param :backup_dir,
|
8
|
-
'Path to backup directory',
|
9
|
-
:required => true
|
10
|
-
end
|
11
|
-
|
12
|
-
def run
|
13
|
-
if feature(:instance).foreman_proxy_with_content?
|
14
|
-
FileUtils.chown(nil, 'postgres', @backup_dir)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|