foreman_maintain 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -4
- data/bin/foreman-maintain +1 -1
- data/bin/foreman-maintain-complete +5 -5
- data/definitions/checks/candlepin/db_up.rb +1 -1
- data/definitions/checks/candlepin/validate_db.rb +2 -9
- data/definitions/checks/check_for_newer_packages.rb +5 -5
- data/definitions/checks/check_hotfix_installed.rb +3 -7
- data/definitions/checks/disk/available_space_postgresql12.rb +3 -2
- data/definitions/checks/disk/performance.rb +3 -3
- data/definitions/checks/foreman/check_corrupted_roles.rb +2 -4
- data/definitions/checks/foreman/check_duplicate_permission.rb +1 -1
- data/definitions/checks/foreman/check_duplicate_roles.rb +1 -1
- data/definitions/checks/foreman/check_tuning_requirements.rb +1 -1
- data/definitions/checks/foreman/db_up.rb +1 -1
- data/definitions/checks/foreman/facts_names.rb +4 -4
- data/definitions/checks/foreman_openscap/invalid_report_associations.rb +4 -4
- data/definitions/checks/foreman_proxy/check_tftp_storage.rb +4 -4
- data/definitions/checks/foreman_proxy/verify_dhcp_config_syntax.rb +1 -2
- data/definitions/checks/foreman_tasks/invalid/check_old.rb +2 -2
- data/definitions/checks/foreman_tasks/invalid/check_pending_state.rb +2 -2
- data/definitions/checks/foreman_tasks/invalid/check_planning_state.rb +2 -2
- data/definitions/checks/foreman_tasks/not_paused.rb +2 -2
- data/definitions/checks/foreman_tasks/not_running.rb +6 -6
- data/definitions/checks/original_assets.rb +3 -3
- data/definitions/checks/package_manager/yum/validate_yum_config.rb +1 -1
- data/definitions/checks/pulpcore/db_up.rb +1 -1
- data/definitions/checks/repositories/check_upstream_repository.rb +2 -2
- data/definitions/checks/repositories/validate.rb +2 -2
- data/definitions/checks/restore/validate_backup.rb +2 -2
- data/definitions/checks/restore/validate_hostname.rb +2 -2
- data/definitions/checks/restore/validate_interfaces.rb +2 -2
- data/definitions/checks/restore/validate_postgresql_dump_permissions.rb +31 -0
- data/definitions/checks/services_up.rb +2 -2
- data/definitions/features/apache.rb +1 -1
- data/definitions/features/candlepin.rb +1 -1
- data/definitions/features/candlepin_database.rb +2 -4
- data/definitions/features/cron.rb +3 -5
- data/definitions/features/dynflow_sidekiq.rb +2 -2
- data/definitions/features/foreman_cockpit.rb +1 -1
- data/definitions/features/foreman_database.rb +1 -1
- data/definitions/features/foreman_proxy.rb +1 -1
- data/definitions/features/foreman_server.rb +2 -2
- data/definitions/features/foreman_tasks.rb +9 -12
- data/definitions/features/gofer.rb +1 -1
- data/definitions/features/hammer.rb +4 -4
- data/definitions/features/installer.rb +4 -5
- data/definitions/features/instance.rb +12 -14
- data/definitions/features/katello.rb +8 -12
- data/definitions/features/pulpcore.rb +5 -3
- data/definitions/features/pulpcore_database.rb +3 -1
- data/definitions/features/puppet_server.rb +1 -1
- data/definitions/features/redis.rb +2 -18
- data/definitions/features/salt_server.rb +1 -1
- data/definitions/features/service.rb +4 -48
- data/definitions/features/sync_plans.rb +2 -2
- data/definitions/features/tar.rb +4 -3
- data/definitions/procedures/backup/compress_data.rb +0 -1
- data/definitions/procedures/backup/config_files.rb +6 -5
- data/definitions/procedures/backup/prepare_directory.rb +0 -2
- data/definitions/procedures/backup/pulp.rb +3 -3
- data/definitions/procedures/backup/snapshot/clean_mount.rb +1 -1
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +1 -2
- data/definitions/procedures/backup/snapshot/mount_pulp.rb +2 -2
- data/definitions/procedures/foreman/fix_corrupted_roles.rb +3 -3
- data/definitions/procedures/foreman_tasks/delete.rb +3 -3
- data/definitions/procedures/hammer_setup.rb +1 -1
- data/definitions/procedures/knowledge_base_article.rb +3 -4
- data/definitions/procedures/packages/enable_modules.rb +1 -1
- data/definitions/procedures/packages/install.rb +1 -1
- data/definitions/procedures/packages/uninstall.rb +1 -1
- data/definitions/procedures/packages/update.rb +1 -1
- data/definitions/procedures/remote_execution/remove_existing_settingsd.rb +2 -2
- data/definitions/procedures/repositories/enable.rb +1 -1
- data/definitions/procedures/repositories/setup.rb +2 -2
- data/definitions/procedures/restore/candlepin_dump.rb +2 -2
- data/definitions/procedures/restore/configs.rb +3 -10
- data/definitions/procedures/restore/drop_databases.rb +2 -2
- data/definitions/procedures/restore/extract_files.rb +4 -17
- data/definitions/procedures/restore/foreman_dump.rb +2 -2
- data/definitions/procedures/restore/installer_reset.rb +1 -2
- data/definitions/procedures/restore/postgres_owner.rb +2 -2
- data/definitions/procedures/restore/pulpcore_dump.rb +2 -2
- data/definitions/procedures/selinux/set_file_security.rb +2 -2
- data/definitions/procedures/service/restart.rb +1 -1
- data/definitions/scenarios/backup.rb +44 -61
- data/definitions/scenarios/packages.rb +9 -9
- data/definitions/scenarios/restore.rb +24 -40
- data/definitions/scenarios/self_upgrade.rb +7 -11
- data/definitions/scenarios/services.rb +17 -17
- data/extras/foreman_protector/foreman-protector.whitelist +0 -6
- data/lib/foreman_maintain/cli/advanced/prebuild_bash_completion.rb +1 -1
- data/lib/foreman_maintain/cli/advanced_command.rb +2 -2
- data/lib/foreman_maintain/cli/backup_command.rb +17 -17
- data/lib/foreman_maintain/cli/base.rb +13 -13
- data/lib/foreman_maintain/cli/maintenance_mode_command.rb +1 -1
- data/lib/foreman_maintain/cli/plugin_command.rb +1 -1
- data/lib/foreman_maintain/cli/restore_command.rb +4 -4
- data/lib/foreman_maintain/cli/self_upgrade_command.rb +2 -2
- data/lib/foreman_maintain/cli/service_command.rb +2 -2
- data/lib/foreman_maintain/cli/transform_clamp_options.rb +1 -1
- data/lib/foreman_maintain/cli/upgrade_command.rb +7 -7
- data/lib/foreman_maintain/cli.rb +1 -11
- data/lib/foreman_maintain/concerns/base_database.rb +8 -17
- data/lib/foreman_maintain/concerns/downstream.rb +6 -64
- data/lib/foreman_maintain/concerns/firewall/iptables_maintenance_mode.rb +1 -1
- data/lib/foreman_maintain/concerns/foreman_and_katello_version_map.rb +1 -1
- data/lib/foreman_maintain/concerns/os_facts.rb +0 -8
- data/lib/foreman_maintain/concerns/primary_checks.rb +6 -5
- data/lib/foreman_maintain/concerns/pulp_common.rb +1 -8
- data/lib/foreman_maintain/concerns/system_helpers.rb +3 -6
- data/lib/foreman_maintain/concerns/upstream.rb +3 -3
- data/lib/foreman_maintain/config.rb +6 -6
- data/lib/foreman_maintain/core_ext.rb +2 -2
- data/lib/foreman_maintain/executable.rb +7 -9
- data/lib/foreman_maintain/package_manager/apt.rb +2 -2
- data/lib/foreman_maintain/package_manager/base.rb +0 -2
- data/lib/foreman_maintain/package_manager/dnf.rb +2 -2
- data/lib/foreman_maintain/package_manager/yum.rb +2 -3
- data/lib/foreman_maintain/package_manager.rb +1 -3
- data/lib/foreman_maintain/param.rb +2 -2
- data/lib/foreman_maintain/reporter/cli_reporter.rb +6 -7
- data/lib/foreman_maintain/reporter.rb +15 -10
- data/lib/foreman_maintain/repository_manager/el.rb +2 -10
- data/lib/foreman_maintain/repository_manager.rb +2 -1
- data/lib/foreman_maintain/runner.rb +5 -5
- data/lib/foreman_maintain/scenario.rb +4 -2
- data/lib/foreman_maintain/upgrade_runner.rb +0 -2
- data/lib/foreman_maintain/utils/backup.rb +27 -111
- data/lib/foreman_maintain/utils/bash.rb +18 -19
- data/lib/foreman_maintain/utils/command_runner.rb +5 -9
- data/lib/foreman_maintain/utils/hash_tools.rb +5 -5
- data/lib/foreman_maintain/utils/response.rb +1 -0
- data/lib/foreman_maintain/utils/service/remote_db.rb +1 -0
- data/lib/foreman_maintain/utils/service/systemd.rb +3 -5
- data/lib/foreman_maintain/utils/service.rb +1 -1
- data/lib/foreman_maintain/utils.rb +0 -1
- data/lib/foreman_maintain/version.rb +1 -1
- data/lib/foreman_maintain/yaml_storage.rb +1 -0
- data/lib/foreman_maintain.rb +3 -3
- metadata +29 -78
- data/definitions/checks/foreman/check_https_proxies.rb +0 -34
- data/definitions/checks/mongo/db_up.rb +0 -33
- data/definitions/checks/mongo/tools_installed.rb +0 -31
- data/definitions/checks/pulpcore/group_ownership_check.rb +0 -18
- data/definitions/checks/puppet/provide_upgrade_guide.rb +0 -35
- data/definitions/checks/puppet/warn_about_puppet_removal.rb +0 -35
- data/definitions/checks/remote_execution/verify_settings_file_already_exists.rb +0 -42
- data/definitions/features/mongo.rb +0 -217
- data/definitions/features/pulp2.rb +0 -35
- data/definitions/procedures/backup/offline/mongo.rb +0 -56
- data/definitions/procedures/backup/online/mongo.rb +0 -21
- data/definitions/procedures/backup/snapshot/mount_mongo.rb +0 -43
- data/definitions/procedures/candlepin/delete_orphaned_records_from_env_content.rb +0 -40
- data/definitions/procedures/content/fix_pulpcore_artifact_permissions.rb +0 -31
- data/definitions/procedures/content/migration_reset.rb +0 -12
- data/definitions/procedures/content/migration_stats.rb +0 -12
- data/definitions/procedures/content/prepare.rb +0 -17
- data/definitions/procedures/content/prepare_abort.rb +0 -12
- data/definitions/procedures/content/switchover.rb +0 -41
- data/definitions/procedures/prep_6_10_upgrade.rb +0 -29
- data/definitions/procedures/pulp/cleanup_old_metadata_files.rb +0 -75
- data/definitions/procedures/pulp/migrate.rb +0 -23
- data/definitions/procedures/pulp/print_remove_instructions.rb +0 -16
- data/definitions/procedures/pulp/remove.rb +0 -222
- data/definitions/procedures/restore/ensure_mongo_engine_matches.rb +0 -35
- data/definitions/procedures/restore/mongo_dump.rb +0 -41
- data/definitions/procedures/restore/regenerate_queues.rb +0 -69
- data/definitions/scenarios/content.rb +0 -158
- data/definitions/scenarios/prep_6_10_upgrade.rb +0 -13
- data/definitions/scenarios/upgrade_to_capsule_6_10.rb +0 -89
- data/definitions/scenarios/upgrade_to_capsule_6_10_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_11.rb +0 -91
- data/definitions/scenarios/upgrade_to_capsule_6_11_z.rb +0 -90
- data/definitions/scenarios/upgrade_to_capsule_6_12.rb +0 -92
- data/definitions/scenarios/upgrade_to_capsule_6_12_z.rb +0 -92
- data/definitions/scenarios/upgrade_to_capsule_6_13.rb +0 -92
- data/definitions/scenarios/upgrade_to_capsule_6_13_z.rb +0 -92
- data/definitions/scenarios/upgrade_to_capsule_6_8.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_8_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_9.rb +0 -88
- data/definitions/scenarios/upgrade_to_capsule_6_9_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_10.rb +0 -113
- data/definitions/scenarios/upgrade_to_satellite_6_10_z.rb +0 -89
- data/definitions/scenarios/upgrade_to_satellite_6_11.rb +0 -96
- data/definitions/scenarios/upgrade_to_satellite_6_11_z.rb +0 -91
- data/definitions/scenarios/upgrade_to_satellite_6_12.rb +0 -95
- data/definitions/scenarios/upgrade_to_satellite_6_12_z.rb +0 -94
- data/definitions/scenarios/upgrade_to_satellite_6_13.rb +0 -95
- data/definitions/scenarios/upgrade_to_satellite_6_13_z.rb +0 -94
- data/definitions/scenarios/upgrade_to_satellite_6_2.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_2_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_3.rb +0 -89
- data/definitions/scenarios/upgrade_to_satellite_6_3_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_4.rb +0 -89
- data/definitions/scenarios/upgrade_to_satellite_6_4_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_5.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_5_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_6.rb +0 -90
- data/definitions/scenarios/upgrade_to_satellite_6_6_z.rb +0 -90
- data/definitions/scenarios/upgrade_to_satellite_6_7.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_7_z.rb +0 -88
- data/definitions/scenarios/upgrade_to_satellite_6_8.rb +0 -91
- data/definitions/scenarios/upgrade_to_satellite_6_8_z.rb +0 -89
- data/definitions/scenarios/upgrade_to_satellite_6_9.rb +0 -91
- data/definitions/scenarios/upgrade_to_satellite_6_9_z.rb +0 -89
- data/lib/foreman_maintain/cli/content_command.rb +0 -69
- data/lib/foreman_maintain/utils/mongo_core.rb +0 -86
@@ -1,16 +0,0 @@
|
|
1
|
-
module Procedures::Pulp
|
2
|
-
class PrintRemoveInstructions < ForemanMaintain::Procedure
|
3
|
-
metadata do
|
4
|
-
description 'Print pulp 2 removal instructions'
|
5
|
-
end
|
6
|
-
|
7
|
-
def run
|
8
|
-
puts '======================================================'
|
9
|
-
puts 'Migration of content from Pulp 2 to Pulp3 is complete'
|
10
|
-
puts 'After verifying accessibility of content from clients,'
|
11
|
-
puts 'it is strongly recommend to run "foreman-maintain content remove-pulp2"'
|
12
|
-
puts 'This will remove Pulp 2, MongoDB, and all pulp2 content in /var/lib/pulp/content/'
|
13
|
-
puts '======================================================'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,222 +0,0 @@
|
|
1
|
-
module Procedures::Pulp
|
2
|
-
class Remove < ForemanMaintain::Procedure
|
3
|
-
metadata do
|
4
|
-
description 'Remove pulp2'
|
5
|
-
param :assumeyes, 'Do not ask for confirmation', :default => false
|
6
|
-
|
7
|
-
confine do
|
8
|
-
check_min_version('katello-common', '4.0')
|
9
|
-
end
|
10
|
-
|
11
|
-
param :assume_yes, 'Run the full removal without asking.'
|
12
|
-
end
|
13
|
-
|
14
|
-
def sys
|
15
|
-
ForemanMaintain::Utils::SystemHelpers.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def pulp_data_dirs
|
19
|
-
[
|
20
|
-
'/etc/pki/pulp/content',
|
21
|
-
'/var/lib/pulp/published',
|
22
|
-
'/var/lib/pulp/content',
|
23
|
-
'/var/lib/pulp/importers',
|
24
|
-
'/var/lib/pulp/uploads',
|
25
|
-
'/var/lib/mongodb/',
|
26
|
-
'/var/cache/pulp',
|
27
|
-
'/var/spool/squid'
|
28
|
-
].select { |dir| File.directory?(dir) }
|
29
|
-
end
|
30
|
-
|
31
|
-
def pulp_data_dirs_mountpoints
|
32
|
-
pulp_data_dirs.select { |d| Pathname(d).mountpoint? }
|
33
|
-
end
|
34
|
-
|
35
|
-
def deletable_pulp_dirs
|
36
|
-
@deletable_pulp_dirs ||= pulp_data_dirs - pulp_data_dirs_mountpoints
|
37
|
-
end
|
38
|
-
|
39
|
-
# rubocop:disable Metrics/MethodLength
|
40
|
-
def pulp_packages
|
41
|
-
possible = %w[pulp-admin-client pulp-agent pulp-consumer-client pulp-deb-admin-extensions
|
42
|
-
pulp-deb-plugins pulp-docker-admin-extensions pulp-docker-plugins
|
43
|
-
pulp-nodes-admin-extensions pulp-nodes-child pulp-nodes-common
|
44
|
-
pulp-nodes-consumer-extensions pulp-nodes-parent pulp-ostree-admin-extensions
|
45
|
-
pulp-ostree-plugins pulp-puppet-admin-extensions
|
46
|
-
pulp-puppet-consumer-extensions pulp-puppet-handlers pulp-puppet-plugins
|
47
|
-
pulp-puppet-tools pulp-python-admin-extensions pulp-python-plugins
|
48
|
-
pulp-rpm-admin-extensions pulp-rpm-consumer-extensions pulp-rpm-handlers
|
49
|
-
pulp-rpm-plugins pulp-rpm-yumplugins pulp-selinux pulp-server python-bson
|
50
|
-
python-crane python-isodate python-mongoengine python-nectar
|
51
|
-
python-pulp-agent-lib python-pulp-bindings python-pulp-client-lib
|
52
|
-
python-pulp-common python-pulp-deb-common python-pulp-devel
|
53
|
-
python-pulp-docker-common python-pulp-integrity python-pulp-manifest
|
54
|
-
python-pulp-oid_validation python-pulp-ostree-common python-pulp-puppet-common
|
55
|
-
python-pulp-python-common python-pulp-repoauth python-pulp-rpm-common
|
56
|
-
python-pulp-streamer python-pymongo python-pymongo-gridfs python2-amqp
|
57
|
-
python2-billiard python2-celery python2-debpkgr python2-django python2-kombu
|
58
|
-
python2-solv python2-vine pulp-katello pulp-maintenance
|
59
|
-
python3-pulp-2to3-migration]
|
60
|
-
|
61
|
-
@installed_pulp_packages ||= possible.select { |pkg| find_package(pkg) }
|
62
|
-
@installed_pulp_packages
|
63
|
-
end
|
64
|
-
|
65
|
-
def data_dir_removal_cmds(pulp_dirs)
|
66
|
-
pulp_dirs.map { |dir| "rm -rf #{dir}" }
|
67
|
-
end
|
68
|
-
|
69
|
-
def ask_to_proceed
|
70
|
-
rm_cmds = data_dir_removal_cmds(pulp_data_dirs)
|
71
|
-
question = "\nWARNING: All pulp2 packages will be removed with the following commands:\n"
|
72
|
-
question += "\n# rpm -e #{pulp_packages.join(' ')}" if pulp_packages.any?
|
73
|
-
question += "\n# yum remove rh-mongodb34-*"
|
74
|
-
question += "\n# yum remove squid mod_wsgi" \
|
75
|
-
"\n\nAll pulp2 data will be removed.\n"
|
76
|
-
question += rm_cmds.collect { |cmd| "\n# #{cmd}" }.join
|
77
|
-
question += "\n\nDo you want to proceed?"
|
78
|
-
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
|
79
|
-
abort! if answer != :yes
|
80
|
-
end
|
81
|
-
|
82
|
-
def run
|
83
|
-
assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
|
84
|
-
|
85
|
-
ask_to_proceed unless assumeyes_val
|
86
|
-
|
87
|
-
remove_pulp if pulp_packages.any?
|
88
|
-
|
89
|
-
remove_mongo
|
90
|
-
|
91
|
-
remove_other_packages
|
92
|
-
|
93
|
-
drop_migration_tables
|
94
|
-
|
95
|
-
drop_migrations
|
96
|
-
|
97
|
-
delete_pulp_data
|
98
|
-
|
99
|
-
restart_pulpcore_services
|
100
|
-
end
|
101
|
-
|
102
|
-
def remove_pulp
|
103
|
-
with_spinner('Removing pulp2 packages') do
|
104
|
-
execute!("rpm -e #{pulp_packages.join(' ')}")
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def remove_mongo
|
109
|
-
with_spinner('Removing mongo packages') do
|
110
|
-
packages_action(:remove, ['rh-mongodb34-*'], :assumeyes => true)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def remove_other_packages
|
115
|
-
with_spinner('Removing additional packages') do
|
116
|
-
packages_action(:remove, %w[squid mod_wsgi], :assumeyes => true)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def drop_migration_tables
|
121
|
-
with_spinner('Dropping migration tables') do
|
122
|
-
feature(:pulpcore_database).psql(<<-SQL)
|
123
|
-
BEGIN;
|
124
|
-
DROP TABLE IF EXISTS pulp_2to3_migration_migrationplan,
|
125
|
-
pulp_2to3_migration_pulp2blob,
|
126
|
-
pulp_2to3_migration_pulp2content,
|
127
|
-
pulp_2to3_migration_pulp2debcomponent,
|
128
|
-
pulp_2to3_migration_pulp2debcomponentpackage,
|
129
|
-
pulp_2to3_migration_pulp2debpackage,
|
130
|
-
pulp_2to3_migration_pulp2debrelease,
|
131
|
-
pulp_2to3_migration_pulp2debreleasearchitecture,
|
132
|
-
pulp_2to3_migration_pulp2distribution,
|
133
|
-
pulp_2to3_migration_pulp2distributor,
|
134
|
-
pulp_2to3_migration_pulp2distributor_pulp2_repos,
|
135
|
-
pulp_2to3_migration_pulp2erratum,
|
136
|
-
pulp_2to3_migration_pulp2importer,
|
137
|
-
pulp_2to3_migration_pulp2iso,
|
138
|
-
pulp_2to3_migration_pulp2lazycatalog,
|
139
|
-
pulp_2to3_migration_pulp2manifest,
|
140
|
-
pulp_2to3_migration_pulp2manifestlist,
|
141
|
-
pulp_2to3_migration_pulp2modulemd,
|
142
|
-
pulp_2to3_migration_pulp2modulemddefaults,
|
143
|
-
pulp_2to3_migration_pulp2packagecategory,
|
144
|
-
pulp_2to3_migration_pulp2packageenvironment,
|
145
|
-
pulp_2to3_migration_pulp2packagegroup,
|
146
|
-
pulp_2to3_migration_pulp2packagelangpacks,
|
147
|
-
pulp_2to3_migration_pulp2repocontent,
|
148
|
-
pulp_2to3_migration_pulp2repository,
|
149
|
-
pulp_2to3_migration_pulp2rpm,
|
150
|
-
pulp_2to3_migration_pulp2srpm,
|
151
|
-
pulp_2to3_migration_pulp2tag,
|
152
|
-
pulp_2to3_migration_pulp2yumrepometadatafile,
|
153
|
-
pulp_2to3_migration_reposetup CASCADE;
|
154
|
-
DROP SEQUENCE IF EXISTS pulp_2to3_migration_pulp2distributor_pulp2_repos_id_seq;
|
155
|
-
END;
|
156
|
-
SQL
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
def drop_migrations
|
161
|
-
with_spinner('Dropping migrations') do
|
162
|
-
feature(:pulpcore_database).psql(<<-SQL)
|
163
|
-
BEGIN;
|
164
|
-
DELETE FROM django_migrations WHERE app = 'pulp_2to3_migration';
|
165
|
-
DELETE FROM auth_permission WHERE content_type_id in (SELECT id FROM django_content_type WHERE app_label = 'pulp_2to3_migration');
|
166
|
-
DELETE FROM django_admin_log WHERE content_type_id in (SELECT id FROM django_content_type WHERE app_label = 'pulp_2to3_migration');
|
167
|
-
DELETE FROM django_content_type WHERE app_label = 'pulp_2to3_migration';
|
168
|
-
END;
|
169
|
-
SQL
|
170
|
-
end
|
171
|
-
end
|
172
|
-
# rubocop:enable Metrics/BlockLength
|
173
|
-
|
174
|
-
def delete_pulp_data
|
175
|
-
non_mountpoints = data_dir_removal_cmds(deletable_pulp_dirs)
|
176
|
-
mountpoints = pulp_data_dirs_mountpoints
|
177
|
-
with_spinner('') do |spinner|
|
178
|
-
if non_mountpoints.any?
|
179
|
-
spinner.update('Deleting pulp2 data directories.')
|
180
|
-
non_mountpoints.each do |cmd|
|
181
|
-
execute!(cmd)
|
182
|
-
end
|
183
|
-
msg_for_del_non_mountpoints(mountpoints, spinner)
|
184
|
-
end
|
185
|
-
if mountpoints.any?
|
186
|
-
msg_for_del_mountpoints(mountpoints, spinner)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
def msg_for_del_non_mountpoints(mountpoints, spinner)
|
192
|
-
if mountpoints.empty?
|
193
|
-
spinner.update('Done deleting all pulp2 data directories.')
|
194
|
-
else
|
195
|
-
spinner.update("Deleted: #{deletable_pulp_dirs.join("\n")}")
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
def msg_for_del_mountpoints(mountpoints, spinner)
|
200
|
-
_, cmd_name = ForemanMaintain.pkg_and_cmd_name
|
201
|
-
if mountpoints.count > 1
|
202
|
-
spinner.update("The directories #{mountpoints.join(',')} are individual mountpoints.")
|
203
|
-
puts "\nThe #{cmd_name} won't delete these directories.\n"\
|
204
|
-
'You need to remove content and these directories on your own.'
|
205
|
-
else
|
206
|
-
spinner.update("The directory #{mountpoints.join(',')} is individual mountpoint.")
|
207
|
-
puts "\nThe #{cmd_name} won't delete the directory.\n"\
|
208
|
-
'You need to remove content and the directory on your own.'
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
def restart_pulpcore_services
|
213
|
-
with_spinner('Restarting pulpcore services') do |spinner|
|
214
|
-
pulp_services = feature(:pulpcore).services
|
215
|
-
|
216
|
-
feature(:service).handle_services(spinner, 'stop', :only => pulp_services)
|
217
|
-
feature(:service).handle_services(spinner, 'start', :only => pulp_services)
|
218
|
-
spinner.update('Done restarting pulpcore services')
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Procedures::Restore
|
2
|
-
class EnsureMongoEngineMatches < ForemanMaintain::Procedure
|
3
|
-
metadata do
|
4
|
-
description 'Ensure restored MongoDB storage engine matches the current DB'
|
5
|
-
for_feature :mongo
|
6
|
-
end
|
7
|
-
|
8
|
-
# rubocop:disable Metrics/AbcSize
|
9
|
-
def run
|
10
|
-
if feature(:mongo).local? && mongo_data_dir_exists? && engine_mismatch?
|
11
|
-
with_spinner('Clean MongoDB data') do |spinner|
|
12
|
-
feature(:service).handle_services(spinner, 'stop', :only => feature(:mongo).services)
|
13
|
-
spinner.update('Clean MongoDB data')
|
14
|
-
data_path = Dir[feature(:mongo).data_dir + '/*']
|
15
|
-
FileUtils.rm_rf(data_path)
|
16
|
-
FileUtils.rm_rf('/var/tmp/mongodb_engine_upgrade')
|
17
|
-
feature(:service).handle_services(spinner, 'start', :only => feature(:mongo).services)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
# rubocop:enable Metrics/AbcSize
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def engine_mismatch?
|
26
|
-
tiger_file = File.join(feature(:mongo).data_dir, 'WiredTiger.wt')
|
27
|
-
config_file = feature(:mongo).core.server_config_files.first
|
28
|
-
File.exist?(tiger_file) && File.open(config_file).grep(/^storage.engine:\s*mmapv1/).any?
|
29
|
-
end
|
30
|
-
|
31
|
-
def mongo_data_dir_exists?
|
32
|
-
File.directory?(feature(:mongo).data_dir)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Procedures::Restore
|
2
|
-
class MongoDump < ForemanMaintain::Procedure
|
3
|
-
metadata do
|
4
|
-
description 'Restore mongo dump'
|
5
|
-
for_feature :pulp2
|
6
|
-
param :backup_dir,
|
7
|
-
'Path to backup directory',
|
8
|
-
:required => true
|
9
|
-
preparation_steps do
|
10
|
-
[Checks::Mongo::DBUp.new, Checks::Mongo::ToolsInstalled.new]
|
11
|
-
end
|
12
|
-
confine do
|
13
|
-
feature(:mongo) && feature(:pulp2)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def run
|
18
|
-
backup = ForemanMaintain::Utils::Backup.new(@backup_dir)
|
19
|
-
with_spinner('Restoring mongo dump') do |spinner|
|
20
|
-
handle_mongo_service('start', spinner)
|
21
|
-
drop_and_restore_mongo(backup, spinner)
|
22
|
-
handle_mongo_service('stop', spinner)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def handle_mongo_service(action, spinner)
|
27
|
-
if feature(:instance).database_local?(:mongo)
|
28
|
-
feature(:service).handle_services(spinner, action,
|
29
|
-
:only => feature(:mongo).services)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def drop_and_restore_mongo(backup, spinner)
|
34
|
-
spinner.update('Dropping pulp_database')
|
35
|
-
feature(:mongo).dropdb
|
36
|
-
|
37
|
-
spinner.update('Restoring mongo dump')
|
38
|
-
feature(:mongo).restore(backup.file_map[:mongo_dump][:path])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
module Procedures::Restore
|
2
|
-
class RegenerateQueues < ForemanMaintain::Procedure
|
3
|
-
metadata do
|
4
|
-
advanced_run false
|
5
|
-
description 'Regenerate required activemq and/or qpidd queues while restoring online backup'
|
6
|
-
confine do
|
7
|
-
feature(:pulp2)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def qpid_router_broker_port
|
12
|
-
@qpid_router_broker_port ||= feature(:installer).
|
13
|
-
answers['foreman_proxy_content']['qpid_router_broker_port']
|
14
|
-
end
|
15
|
-
|
16
|
-
def qpid_configs
|
17
|
-
@qpid_configs ||= {
|
18
|
-
'ssl_cert' => "/etc/pki/katello/certs/#{hostname}-qpid-broker.crt",
|
19
|
-
'ssl_key' => "/etc/pki/katello/private/#{hostname}-qpid-broker.key",
|
20
|
-
'amqps_url' => "amqps://localhost:#{qpid_router_broker_port}"
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
def katello_events
|
25
|
-
%w[compliance.created
|
26
|
-
entitlement.created
|
27
|
-
entitlement.deleted
|
28
|
-
pool.created
|
29
|
-
pool.deleted]
|
30
|
-
end
|
31
|
-
|
32
|
-
def run
|
33
|
-
with_spinner('Resetting the queues') do |spinner|
|
34
|
-
regenerate_activemq_queues(spinner) if feature(:candlepin)
|
35
|
-
regenerate_qpidd_queues(spinner)
|
36
|
-
spinner.update('Queues created successfully')
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def regenerate_activemq_queues(spinner)
|
41
|
-
# The activemq queues(/var/lib/candlepin/activemq-artemis) regenerate on tomcat restart.
|
42
|
-
# After stopping the tomcat here, service start is triggered from the restore scenario.
|
43
|
-
spinner.update('Stopping tomcat service')
|
44
|
-
feature(:candlepin).services.select(&:exist?).first.stop
|
45
|
-
spinner.update('Recreating activemq queues')
|
46
|
-
execute!('rm -rf /var/lib/candlepin/activemq-artemis/')
|
47
|
-
end
|
48
|
-
|
49
|
-
def run_qpid_command(opts)
|
50
|
-
execute!("qpid-config --ssl-certificate #{qpid_configs['ssl_cert']} \\
|
51
|
-
--ssl-key #{qpid_configs['ssl_key']} -b #{qpid_configs['amqps_url']} #{opts}")
|
52
|
-
end
|
53
|
-
|
54
|
-
def regenerate_qpidd_queues(spinner)
|
55
|
-
feature(:service).handle_services(spinner, 'stop', :only => ['qpidd'])
|
56
|
-
execute!('rm -rf /var/lib/qpidd/.qpidd/qls')
|
57
|
-
spinner.update('Starting qpidd service')
|
58
|
-
feature(:service).handle_services(spinner, 'start', :only => ['qpidd'])
|
59
|
-
spinner.update('Service qpidd started, waiting 60 seconds to start it completely')
|
60
|
-
sleep 60
|
61
|
-
spinner.update('Recreating qpidd queues')
|
62
|
-
run_qpid_command('add exchange topic event --durable')
|
63
|
-
run_qpid_command('add queue katello_event_queue --durable')
|
64
|
-
katello_events.each do |event|
|
65
|
-
run_qpid_command("bind event katello_event_queue #{event}")
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,158 +0,0 @@
|
|
1
|
-
module ForemanMaintain::Scenarios
|
2
|
-
module Content
|
3
|
-
class ContentBase < ForemanMaintain::Scenario
|
4
|
-
def enable_and_start_services
|
5
|
-
add_step(Procedures::Service::Enable.
|
6
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
7
|
-
add_step(Procedures::Service::Start.
|
8
|
-
new(:include => Features::Pulpcore.pulpcore_migration_services))
|
9
|
-
end
|
10
|
-
|
11
|
-
def disable_and_stop_services
|
12
|
-
add_step(Procedures::Service::Stop.
|
13
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
14
|
-
add_step(Procedures::Service::Disable.
|
15
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class Prepare < ContentBase
|
20
|
-
metadata do
|
21
|
-
label :content_prepare
|
22
|
-
description 'Prepare content for Pulp 3'
|
23
|
-
manual_detection
|
24
|
-
end
|
25
|
-
|
26
|
-
def compose
|
27
|
-
if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
|
28
|
-
enable_and_start_services
|
29
|
-
add_step(Procedures::Content::Prepare.new(quiet: quiet?))
|
30
|
-
disable_and_stop_services
|
31
|
-
elsif !feature(:satellite)
|
32
|
-
add_step(Procedures::Content::Prepare.new(quiet: quiet?))
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def quiet?
|
39
|
-
!!context.get(:quiet)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class Switchover < ContentBase
|
44
|
-
metadata do
|
45
|
-
label :content_switchover
|
46
|
-
description 'Switch support for certain content from Pulp 2 to Pulp 3'
|
47
|
-
manual_detection
|
48
|
-
end
|
49
|
-
|
50
|
-
def compose
|
51
|
-
add_step_with_context(Procedures::Content::Switchover)
|
52
|
-
add_step(Procedures::Foreman::ApipieCache)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class PrepareAbort < ContentBase
|
57
|
-
metadata do
|
58
|
-
label :content_prepare_abort
|
59
|
-
description 'Abort all running Pulp 2 to Pulp 3 migration tasks'
|
60
|
-
manual_detection
|
61
|
-
end
|
62
|
-
|
63
|
-
def compose
|
64
|
-
if !feature(:satellite) || feature(:satellite).at_least_version?('6.9')
|
65
|
-
enable_and_start_services if feature(:satellite)
|
66
|
-
add_step(Procedures::Content::PrepareAbort)
|
67
|
-
disable_and_stop_services if feature(:satellite)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
class MigrationStats < ContentBase
|
73
|
-
metadata do
|
74
|
-
label :content_migration_stats
|
75
|
-
description 'Retrieve Pulp 2 to Pulp 3 migration statistics'
|
76
|
-
manual_detection
|
77
|
-
end
|
78
|
-
|
79
|
-
def compose
|
80
|
-
if !feature(:satellite) || feature(:satellite).at_least_version?('6.9')
|
81
|
-
add_step(Procedures::Content::MigrationStats)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
class MigrationReset < ContentBase
|
87
|
-
metadata do
|
88
|
-
label :content_migration_reset
|
89
|
-
description 'Reset the Pulp 2 to Pulp 3 migration data (pre-switchover)'
|
90
|
-
manual_detection
|
91
|
-
end
|
92
|
-
|
93
|
-
def compose
|
94
|
-
if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
|
95
|
-
enable_and_start_services
|
96
|
-
add_step(Procedures::Content::MigrationReset)
|
97
|
-
disable_and_stop_services
|
98
|
-
elsif !feature(:satellite)
|
99
|
-
add_step(Procedures::Content::MigrationReset)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
class CleanupRepositoryMetadata < ContentBase
|
105
|
-
metadata do
|
106
|
-
label :cleanup_repository_metadata
|
107
|
-
description 'Remove old leftover repository metadata'
|
108
|
-
param :remove_files, 'Actually remove the files? Otherwise a dryrun is performed.'
|
109
|
-
|
110
|
-
manual_detection
|
111
|
-
end
|
112
|
-
|
113
|
-
def compose
|
114
|
-
add_step_with_context(Procedures::Pulp::CleanupOldMetadataFiles)
|
115
|
-
end
|
116
|
-
|
117
|
-
def set_context_mapping
|
118
|
-
context.map(:remove_files, Procedures::Pulp::CleanupOldMetadataFiles => :remove_files)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
class RemovePulp2 < ContentBase
|
123
|
-
metadata do
|
124
|
-
label :content_remove_pulp2
|
125
|
-
description 'Remove Pulp2 and mongodb packages and data'
|
126
|
-
param :assumeyes, 'Do not ask for confirmation'
|
127
|
-
manual_detection
|
128
|
-
end
|
129
|
-
|
130
|
-
def set_context_mapping
|
131
|
-
context.map(:assumeyes, Procedures::Pulp::Remove => :assumeyes)
|
132
|
-
context.map(:assumeyes, Procedures::Content::FixPulpcoreArtifactOwnership => :assumeyes)
|
133
|
-
end
|
134
|
-
|
135
|
-
def compose
|
136
|
-
add_step_with_context(Procedures::Pulp::Remove)
|
137
|
-
add_step_with_context(Procedures::Content::FixPulpcoreArtifactOwnership)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
class FixPulpcoreArtifactOwnership < ContentBase
|
142
|
-
metadata do
|
143
|
-
label :content_fix_pulpcore_artifact_ownership
|
144
|
-
description 'Fix Pulpcore artifact ownership to be pulp:pulp'
|
145
|
-
param :assumeyes, 'Do not ask for confirmation'
|
146
|
-
manual_detection
|
147
|
-
end
|
148
|
-
|
149
|
-
def set_context_mapping
|
150
|
-
context.map(:assumeyes, Procedures::Content::FixPulpcoreArtifactOwnership => :assumeyes)
|
151
|
-
end
|
152
|
-
|
153
|
-
def compose
|
154
|
-
add_step_with_context(Procedures::Content::FixPulpcoreArtifactOwnership)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module ForemanMaintain::Scenarios
|
2
|
-
class Prep610Upgrade < ForemanMaintain::Scenario
|
3
|
-
metadata do
|
4
|
-
label :prep_6_10_upgrade
|
5
|
-
description 'Preparations for the Satellite 6.10 upgrade'
|
6
|
-
manual_detection
|
7
|
-
end
|
8
|
-
|
9
|
-
def compose
|
10
|
-
add_step(Procedures::Prep610Upgrade)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,89 +0,0 @@
|
|
1
|
-
module Scenarios::Capsule_6_10
|
2
|
-
class Abstract < ForemanMaintain::Scenario
|
3
|
-
def self.upgrade_metadata(&block)
|
4
|
-
metadata do
|
5
|
-
tags :upgrade_scenario
|
6
|
-
confine do
|
7
|
-
feature(:capsule) &&
|
8
|
-
(feature(:capsule).current_minor_version == '6.9' || \
|
9
|
-
ForemanMaintain.upgrade_in_progress == '6.10')
|
10
|
-
end
|
11
|
-
instance_eval(&block)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def target_version
|
16
|
-
'6.10'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class PreUpgradeCheck < Abstract
|
21
|
-
upgrade_metadata do
|
22
|
-
description 'Checks before upgrading to Capsule 6.10'
|
23
|
-
tags :pre_upgrade_checks
|
24
|
-
run_strategy :fail_slow
|
25
|
-
end
|
26
|
-
|
27
|
-
def compose
|
28
|
-
add_steps(find_checks(:default))
|
29
|
-
add_steps(find_checks(:pre_upgrade))
|
30
|
-
add_step(Checks::Repositories::Validate.new(:version => '6.10'))
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class PreMigrations < Abstract
|
35
|
-
upgrade_metadata do
|
36
|
-
description 'Procedures before migrating to Capsule 6.10'
|
37
|
-
tags :pre_migrations
|
38
|
-
end
|
39
|
-
|
40
|
-
def compose
|
41
|
-
add_steps(find_procedures(:pre_migrations))
|
42
|
-
add_step(Procedures::Service::Stop.new)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class Migrations < Abstract
|
47
|
-
upgrade_metadata do
|
48
|
-
description 'Migration scripts to Capsule 6.10'
|
49
|
-
tags :migrations
|
50
|
-
end
|
51
|
-
|
52
|
-
def set_context_mapping
|
53
|
-
context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
|
54
|
-
end
|
55
|
-
|
56
|
-
def compose
|
57
|
-
add_step(Procedures::Repositories::Setup.new(:version => '6.10'))
|
58
|
-
add_step(Procedures::Packages::UnlockVersions.new)
|
59
|
-
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
60
|
-
add_step_with_context(Procedures::Installer::Upgrade)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
class PostMigrations < Abstract
|
65
|
-
upgrade_metadata do
|
66
|
-
description 'Procedures after migrating to Capsule 6.10'
|
67
|
-
tags :post_migrations
|
68
|
-
end
|
69
|
-
|
70
|
-
def compose
|
71
|
-
add_step(Procedures::RefreshFeatures)
|
72
|
-
add_step(Procedures::Service::Start.new)
|
73
|
-
add_steps(find_procedures(:post_migrations))
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
class PostUpgradeChecks < Abstract
|
78
|
-
upgrade_metadata do
|
79
|
-
description 'Checks after upgrading to Capsule 6.10'
|
80
|
-
tags :post_upgrade_checks
|
81
|
-
run_strategy :fail_slow
|
82
|
-
end
|
83
|
-
|
84
|
-
def compose
|
85
|
-
add_steps(find_checks(:default))
|
86
|
-
add_steps(find_checks(:post_upgrade))
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|