katello 3.18.1 → 3.18.3.1
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/app/assets/stylesheets/katello/katello.scss +0 -72
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +4 -6
- data/app/controllers/katello/api/v2/api_controller.rb +1 -2
- data/app/controllers/katello/api/v2/content_view_filters_controller.rb +1 -1
- data/app/controllers/katello/concerns/api/v2/authorization.rb +14 -1
- data/app/lib/actions/katello/host/update_system_purpose.rb +1 -1
- data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +1 -1
- data/app/lib/actions/katello/repository/sync.rb +5 -1
- data/app/lib/actions/pulp3/content_migration_reset.rb +22 -0
- data/app/lib/katello/util/hostgroup_facets_helper.rb +126 -0
- data/app/lib/katello/util/pulpcore_content_filters.rb +1 -1
- data/app/models/katello/concerns/hostgroup_extensions.rb +4 -2
- data/app/models/katello/concerns/pulp_database_unit.rb +12 -0
- data/app/models/katello/concerns/redhat_extensions.rb +9 -8
- data/app/models/katello/concerns/smart_proxy_extensions.rb +3 -1
- data/app/models/katello/file_unit.rb +4 -0
- data/app/models/katello/host/content_facet.rb +9 -31
- data/app/models/katello/ping.rb +35 -15
- data/app/services/katello/applicability/applicable_content_helper.rb +40 -20
- data/app/services/katello/pulp3/api/core.rb +14 -0
- data/app/services/katello/pulp3/erratum.rb +2 -1
- data/app/services/katello/pulp3/migration.rb +63 -7
- data/app/services/katello/pulp3/migration_plan.rb +2 -2
- data/app/services/katello/pulp3/migration_switchover.rb +36 -5
- data/app/services/katello/pulp3/repository.rb +40 -10
- data/app/services/katello/pulp3/repository/apt.rb +1 -2
- data/app/services/katello/pulp3/repository/yum.rb +10 -1
- data/app/services/katello/pulp3/rpm.rb +5 -1
- data/app/services/katello/pulp3/task.rb +8 -5
- data/app/services/katello/pulp3/task_group.rb +13 -5
- data/app/views/katello/sync_management/_products.html.erb +1 -1
- data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
- data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +5 -2
- data/db/migrate/20210201165835_add_migration_missing_content.rb +12 -0
- data/db/migrate/20210420140050_add_pulp3_hrefs_to_content_types_deb.rb +5 -0
- data/engines/bastion/app/assets/javascripts/bastion/auth/authorization.service.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +35 -40
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +1 -1
- data/lib/katello/engine.rb +1 -1
- data/lib/katello/tasks/check_config.rake +18 -0
- data/lib/katello/tasks/delete_orphaned_content.rake +1 -3
- data/lib/katello/tasks/fix_hostgroup_facets.rake +8 -0
- data/lib/katello/tasks/pulp3_content_switchover.rake +7 -3
- data/lib/katello/tasks/pulp3_migration.rake +12 -3
- data/lib/katello/tasks/pulp3_migration_abort.rake +1 -1
- data/lib/katello/tasks/pulp3_migration_approve_corrupted.rake +16 -0
- data/lib/katello/tasks/pulp3_migration_reset.rake +26 -0
- data/lib/katello/tasks/pulp3_migration_stats.rake +37 -3
- data/lib/katello/tasks/pulp3_post_migration_check.rake +1 -3
- data/lib/katello/tasks/reimport.rake +1 -1
- data/lib/katello/tasks/reports.rake +4 -1
- data/lib/katello/tasks/repository.rake +3 -5
- data/lib/katello/version.rb +1 -1
- data/webpack/components/TypeAhead/TypeAhead.js +2 -1
- data/webpack/components/TypeAhead/pf3Search/TypeAheadSearch.js +2 -1
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +7 -2
- data/webpack/scenes/Subscriptions/Manifest/index.js +1 -0
- metadata +28 -21
- data/lib/katello/tasks/common.rake +0 -7
|
@@ -27,8 +27,7 @@ module Katello
|
|
|
27
27
|
popts = super(repository_version)
|
|
28
28
|
popts.merge!(
|
|
29
29
|
{
|
|
30
|
-
#
|
|
31
|
-
#structured: true, # publish real suites (e.g. 'stable')
|
|
30
|
+
structured: true, # publish real suites (e.g. 'stable')
|
|
32
31
|
simple: true # publish all into 'default'-suite
|
|
33
32
|
}
|
|
34
33
|
)
|
|
@@ -14,7 +14,16 @@ module Katello
|
|
|
14
14
|
url, sles_token = extract_sles_token
|
|
15
15
|
options = common_remote_options
|
|
16
16
|
options.merge!(sles_auth_token: sles_token) if sles_token
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
options.merge!(url: url, policy: translated_download_policy)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def translated_download_policy
|
|
22
|
+
if root.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_BACKGROUND
|
|
23
|
+
::Runcible::Models::YumImporter::DOWNLOAD_IMMEDIATE
|
|
24
|
+
else
|
|
25
|
+
root.download_policy
|
|
26
|
+
end
|
|
18
27
|
end
|
|
19
28
|
|
|
20
29
|
def extract_sles_token
|
|
@@ -111,6 +111,10 @@ module Katello
|
|
|
111
111
|
backend_data['rpm_license']
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
+
def parse_filename(path)
|
|
115
|
+
File.split(path).last unless path.blank?
|
|
116
|
+
end
|
|
117
|
+
|
|
114
118
|
def update_model(model)
|
|
115
119
|
custom_json = {}
|
|
116
120
|
custom_json['modular'] = backend_data['is_modular']
|
|
@@ -119,7 +123,7 @@ module Katello
|
|
|
119
123
|
each { |field| custom_json[field] = backend_data[field] }
|
|
120
124
|
custom_json['release_sortable'] = Util::Package.sortable_version(backend_data['release'])
|
|
121
125
|
custom_json['version_sortable'] = Util::Package.sortable_version(backend_data['version'])
|
|
122
|
-
custom_json['filename'] = backend_data['location_href']
|
|
126
|
+
custom_json['filename'] = parse_filename(backend_data['location_href']) #location_href is the relative path of the rpm in the upstream repo
|
|
123
127
|
custom_json['checksum'] = backend_data['pkgId']
|
|
124
128
|
custom_json['sourcerpm'] = backend_data['rpm_sourcerpm']
|
|
125
129
|
model.assign_attributes(custom_json)
|
|
@@ -56,8 +56,10 @@ module Katello
|
|
|
56
56
|
@pulp_data ||= tasks_api.read(@href).as_json.with_indifferent_access
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
delegate :tasks_api, to: :core_api
|
|
60
|
+
|
|
61
|
+
def core_api
|
|
62
|
+
::Katello::Pulp3::Api::Core.new(@smart_proxy)
|
|
61
63
|
end
|
|
62
64
|
|
|
63
65
|
def task_group_href
|
|
@@ -94,10 +96,11 @@ module Katello
|
|
|
94
96
|
end
|
|
95
97
|
|
|
96
98
|
def cancel
|
|
97
|
-
|
|
98
|
-
tasks_api.tasks_cancel(task_data['pulp_href'], data)
|
|
99
|
+
core_api.cancel_task(task_data['pulp_href'])
|
|
99
100
|
#the main task may have completed, so cancel spawned tasks too
|
|
100
|
-
task_data['spawned_tasks']&.each
|
|
101
|
+
task_data['spawned_tasks']&.each do |spawned|
|
|
102
|
+
core_api.cancel_task(spawned['pulp_href'])
|
|
103
|
+
end
|
|
101
104
|
end
|
|
102
105
|
end
|
|
103
106
|
end
|
|
@@ -71,17 +71,25 @@ module Katello
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def error
|
|
74
|
+
return if task_group_data[WAITING] > 0 || task_group_data[RUNNING] > 0
|
|
74
75
|
if task_group_data[FAILED] > 0
|
|
75
76
|
"#{task_group_data[FAILED]} subtask(s) failed for task group #{@href}."
|
|
77
|
+
elsif task_group_data[CANCELLED] > 0
|
|
78
|
+
"#{task_group_data[CANCELLED]} subtask(s) cancelled for task group #{@href}."
|
|
76
79
|
end
|
|
77
80
|
end
|
|
78
81
|
|
|
82
|
+
def core_api
|
|
83
|
+
::Katello::Pulp3::Api::Core.new(@smart_proxy)
|
|
84
|
+
end
|
|
85
|
+
|
|
79
86
|
def cancel
|
|
80
|
-
tasks_api =
|
|
81
|
-
tasks_response =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
tasks_api = core_api.tasks_api
|
|
88
|
+
tasks_response = core_api.fetch_from_list do |page_opts|
|
|
89
|
+
tasks_api.list(page_opts.merge(task_group: task_group_data['pulp_href'], state__in: 'running,waiting'))
|
|
90
|
+
end
|
|
91
|
+
tasks_response.collect do |result|
|
|
92
|
+
::Katello::Pulp3::Api::Core.new(@smart_proxy).cancel_task(result.pulp_href)
|
|
85
93
|
end
|
|
86
94
|
end
|
|
87
95
|
end
|
|
@@ -329,7 +329,7 @@ class MigrateContentHosts < ActiveRecord::Migration[4.2]
|
|
|
329
329
|
# rubocop:disable Metrics/MethodLength
|
|
330
330
|
# rubocop:disable Metrics/AbcSize
|
|
331
331
|
def up
|
|
332
|
-
|
|
332
|
+
unless User.unscoped.where(:login => User::ANONYMOUS_API_ADMIN).exists?
|
|
333
333
|
logger.warn("Foreman anonymous admin does not exist, skipping content host migration.")
|
|
334
334
|
return
|
|
335
335
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class MoveKatelloFieldsFromHostgroups < ActiveRecord::Migration[6.0]
|
|
2
2
|
def up
|
|
3
|
-
if User.where(login: User::ANONYMOUS_ADMIN).exists?
|
|
3
|
+
if User.unscoped.where(login: User::ANONYMOUS_ADMIN).exists?
|
|
4
4
|
User.as_anonymous_admin do
|
|
5
5
|
copy_data_from_hostgroup
|
|
6
6
|
end
|
|
@@ -46,7 +46,10 @@ class MoveKatelloFieldsFromHostgroups < ActiveRecord::Migration[6.0]
|
|
|
46
46
|
content_facet.kickstart_repository_id = kickstart_repository_id
|
|
47
47
|
content_facet.content_view_id = content_view_id
|
|
48
48
|
content_facet.lifecycle_environment_id = lifecycle_environment_id
|
|
49
|
-
content_facet.save
|
|
49
|
+
unless content_facet.save(validate: false)
|
|
50
|
+
Rails.logger.warn("Unable to save content facet hostgroup for #{content_facet.inspect} ")
|
|
51
|
+
Rails.logger.warn(content_facet.errors.full_messages.join("\n"))
|
|
52
|
+
end
|
|
50
53
|
end
|
|
51
54
|
end
|
|
52
55
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class AddMigrationMissingContent < ActiveRecord::Migration[6.0]
|
|
2
|
+
def change
|
|
3
|
+
content_models = [Katello::Rpm, Katello::ModuleStream, Katello::Erratum, Katello::PackageGroup, Katello::YumMetadataFile,
|
|
4
|
+
Katello::Srpm, Katello::FileUnit, Katello::DockerManifestList, Katello::DockerManifest, Katello::DockerTag,
|
|
5
|
+
Katello::Deb]
|
|
6
|
+
|
|
7
|
+
content_models.each do |model|
|
|
8
|
+
add_column model.table_name, :missing_from_migration, :bool, :default => false, :null => false
|
|
9
|
+
add_column model.table_name, :ignore_missing_from_migration, :bool, :default => false, :null => false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -20,7 +20,7 @@ angular.module('Bastion.auth').service('Authorization', ['CurrentUser', 'Permiss
|
|
|
20
20
|
allowedTo = model.permissions[permissionName];
|
|
21
21
|
} else {
|
|
22
22
|
angular.forEach(Permissions, function (permission) {
|
|
23
|
-
if (permission.
|
|
23
|
+
if (permission.name === permissionName) {
|
|
24
24
|
allowedTo = true;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<div data-extend-template="components/views/bst-modal.html">
|
|
2
|
-
<
|
|
2
|
+
<h2 data-block="modal-header" translate>Assign System Purpose</h2>
|
|
3
3
|
|
|
4
4
|
<div data-block="modal-body">
|
|
5
|
-
<h4 translate>Assign System Purpose:</h4>
|
|
6
5
|
|
|
7
6
|
<div class="row">
|
|
8
7
|
<div class="col-sm-12">
|
|
@@ -10,67 +9,63 @@
|
|
|
10
9
|
</div>
|
|
11
10
|
</div>
|
|
12
11
|
|
|
12
|
+
<div bst-alert="info">
|
|
13
|
+
<span translate>
|
|
14
|
+
This change will be applied to <b>{{ hostCount }} systems.</b>
|
|
15
|
+
</span>
|
|
16
|
+
</div>
|
|
17
|
+
<br />
|
|
18
|
+
|
|
13
19
|
<form name="contentHostContentForm" class="form" ng-hide="content.workingMode">
|
|
14
|
-
<div>
|
|
15
|
-
<
|
|
20
|
+
<div><b>
|
|
21
|
+
<dl class="dl-horizontal dl-horizontal-left">
|
|
22
|
+
<dt><label translate>Service Level (SLA):</label></dt>
|
|
16
23
|
|
|
17
|
-
<select type="select"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</select>
|
|
21
|
-
|
|
24
|
+
<dd><select type="select"
|
|
25
|
+
ng-options="item for item in defaultServiceLevels"
|
|
26
|
+
ng-model="selectedServiceLevels">
|
|
27
|
+
</select></dd>
|
|
28
|
+
<br /><br />
|
|
22
29
|
|
|
23
|
-
<label translate>Usage Type:</label>
|
|
30
|
+
<dt style="margin-left: -50px;"><label translate>Usage Type:</label></dt>
|
|
24
31
|
|
|
25
|
-
<select type="select"
|
|
32
|
+
<dd><select type="select"
|
|
26
33
|
ng-options="item for item in defaultUsages"
|
|
27
34
|
ng-model="selectedRoles">
|
|
28
|
-
</select>
|
|
35
|
+
</select></dd>
|
|
29
36
|
<br /><br />
|
|
30
37
|
|
|
31
|
-
<label translate>Role:</label>
|
|
38
|
+
<dt style="margin-left: -98px;"><label translate>Role:</label></dt>
|
|
32
39
|
|
|
33
|
-
<select type="select"
|
|
40
|
+
<dd><select type="select"
|
|
34
41
|
ng-options="item for item in defaultRoles"
|
|
35
42
|
ng-model="selectedUsages">
|
|
36
|
-
</select>
|
|
43
|
+
</select></dd>
|
|
37
44
|
<br /><br />
|
|
38
45
|
|
|
39
|
-
<label ng-hide="!purposeAddonsList().length" translate>Add ons:</label>
|
|
40
|
-
<div class="help-block" style="text-align:left;">
|
|
41
|
-
<p translate>ctrl-click or shift-click to select multiple Add ons</p>
|
|
42
|
-
</div>
|
|
46
|
+
<dt style="margin-left: -75px;"><label ng-hide="!purposeAddonsList().length" translate>Add ons:</label></dt>
|
|
43
47
|
|
|
44
|
-
<select multiple ng-multiple="true"
|
|
48
|
+
<dd><select multiple ng-multiple="true"
|
|
45
49
|
ng-hide="!purposeAddonsList().length"
|
|
46
50
|
ng-options="item for item in purposeAddonsList()"
|
|
47
51
|
ng-model="selectedAddons">
|
|
48
|
-
</select>
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<div bst-alert="info" ng-show="showConfirm">
|
|
54
|
-
<span translate>
|
|
55
|
-
Set System Purpose values on {{ hostCount }} selected content hosts?
|
|
56
|
-
</span>
|
|
57
|
-
<div>
|
|
58
|
-
<br />
|
|
59
|
-
<button type="button" class="btn btn-primary" ng-click="showConfirm = false; performAction()" translate>Assign</button>
|
|
52
|
+
</select></dd>
|
|
53
|
+
<div class="help-block" style="text-align:center; margin-left: -180px;">
|
|
54
|
+
<p translate>ctrl-click or shift-click to select multiple Add ons</p>
|
|
60
55
|
</div>
|
|
56
|
+
<br /><br />
|
|
57
|
+
</dl></b>
|
|
61
58
|
</div>
|
|
62
|
-
|
|
63
|
-
<button class="btn btn-primary"
|
|
64
|
-
type="button"
|
|
65
|
-
ng-hide="showConfirm"
|
|
66
|
-
ng-click="showConfirm = true;">
|
|
67
|
-
<span translate>Assign</span>
|
|
68
|
-
</button>
|
|
69
|
-
|
|
70
59
|
</form>
|
|
71
60
|
</div>
|
|
72
61
|
|
|
73
62
|
<div data-block="modal-footer">
|
|
63
|
+
<button class="btn btn-primary"
|
|
64
|
+
type="button"
|
|
65
|
+
ng-click="performAction()">
|
|
66
|
+
<span translate>Assign</span>
|
|
67
|
+
</button>
|
|
68
|
+
|
|
74
69
|
<button type="button" class="btn btn-default" ng-click="cancel()" translate>
|
|
75
70
|
Cancel
|
|
76
71
|
</button>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<section>
|
|
13
13
|
<p bst-alert="warning" >
|
|
14
14
|
<span translate>
|
|
15
|
-
Katello-agent is deprecated and will be removed in
|
|
15
|
+
Katello-agent is deprecated and will be removed in a future release.
|
|
16
16
|
</span>
|
|
17
17
|
</p>
|
|
18
18
|
</section>
|
data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot
CHANGED
|
@@ -2778,7 +2778,7 @@ msgstr ""
|
|
|
2778
2778
|
|
|
2779
2779
|
#: app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html
|
|
2780
2780
|
#: app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html
|
|
2781
|
-
msgid "Katello-agent is deprecated and will be removed in
|
|
2781
|
+
msgid "Katello-agent is deprecated and will be removed in a future release."
|
|
2782
2782
|
msgstr ""
|
|
2783
2783
|
|
|
2784
2784
|
#: app/assets/javascripts/bastion_katello/content-views/details/views/content-view-info.html
|
data/lib/katello/engine.rb
CHANGED
|
@@ -75,7 +75,7 @@ module Katello
|
|
|
75
75
|
|
|
76
76
|
# make sure the Katello plugin is initialized before `after_initialize`
|
|
77
77
|
# hook so that the resumed Dynflow tasks can rely on everything ready.
|
|
78
|
-
initializer 'katello.register_plugin', :before => :finisher_hook do
|
|
78
|
+
initializer 'katello.register_plugin', :before => :finisher_hook, :after => 'foreman_remote_execution.register_plugin' do
|
|
79
79
|
::Foreman::AccessControl::Permission.prepend ::Katello::Concerns::PermissionExtensions
|
|
80
80
|
require 'katello/plugin'
|
|
81
81
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
namespace :katello do
|
|
2
|
+
task :check_config => ['environment'] do
|
|
3
|
+
desc "Task that can be run before a content migration to check that the configuration valid"
|
|
4
|
+
fail_msg = _("The system appears to already be using pulp3 with all content migrated.")
|
|
5
|
+
|
|
6
|
+
puts "Checking for valid Katello configuraton."
|
|
7
|
+
if SETTINGS[:katello][:use_pulp_2_for_content_type].nil?
|
|
8
|
+
fail fail_msg
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
if !SETTINGS[:katello][:use_pulp_2_for_content_type][:docker] &&
|
|
12
|
+
!SETTINGS[:katello][:use_pulp_2_for_content_type][:file] &&
|
|
13
|
+
!SETTINGS[:katello][:use_pulp_2_for_content_type][:yum] &&
|
|
14
|
+
!SETTINGS[:katello][:use_pulp_2_for_content_type][:deb]
|
|
15
|
+
fail fail_msg
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
load "#{Katello::Engine.root}/lib/katello/tasks/common.rake"
|
|
2
|
-
|
|
3
1
|
namespace :katello do
|
|
4
2
|
desc "Remove orphaned and unneeded content/repos from a smart proxy.\
|
|
5
3
|
Run with SMART_PROXY_ID=1 to run for a single smart proxy."
|
|
6
|
-
task :delete_orphaned_content => ["
|
|
4
|
+
task :delete_orphaned_content => ["dynflow:client"] do
|
|
7
5
|
User.current = User.anonymous_admin
|
|
8
6
|
smart_proxy_id = ENV['SMART_PROXY_ID']
|
|
9
7
|
if smart_proxy_id
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
namespace :katello do
|
|
2
|
+
desc "This task collates hostgroup content facts that were missed during the upgrade from audit.\
|
|
3
|
+
It then updates the hostgroup content_facet accordingly."
|
|
4
|
+
task :fix_hostgroup_facets => :environment do
|
|
5
|
+
User.current = User.anonymous_admin
|
|
6
|
+
::Katello::Util::HostgroupFacetsHelper.new.main
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -3,20 +3,24 @@ require "#{Katello::Engine.root}/app/services/katello/pulp3/migration_switchover
|
|
|
3
3
|
|
|
4
4
|
namespace :katello do
|
|
5
5
|
desc "Runs a Pulp 3 migration of pulp3 hrefs to pulp ids for supported content types."
|
|
6
|
-
task :pulp3_content_switchover => :
|
|
6
|
+
task :pulp3_content_switchover => ["dynflow:client", "check_config"] do
|
|
7
|
+
dryrun = ENV['DRYRUN']
|
|
8
|
+
|
|
7
9
|
begin
|
|
8
10
|
User.current = User.anonymous_admin
|
|
9
11
|
|
|
12
|
+
switchover_service = Katello::Pulp3::MigrationSwitchover.new(SmartProxy.pulp_primary)
|
|
13
|
+
switchover_service.remove_orphaned_content #run out of transaction for easier re-run
|
|
10
14
|
ActiveRecord::Base.transaction do
|
|
11
|
-
switchover_service = Katello::Pulp3::MigrationSwitchover.new(SmartProxy.pulp_primary)
|
|
12
15
|
switchover_service.run
|
|
16
|
+
fail "Dryrun completed without error, aborting and rolling back" if dryrun
|
|
13
17
|
end
|
|
14
18
|
rescue Katello::Pulp3::SwitchOverError => e
|
|
15
19
|
$stderr.print(e.message)
|
|
16
20
|
exit 1
|
|
17
21
|
end
|
|
18
22
|
|
|
19
|
-
task = ForemanTasks.
|
|
23
|
+
task = ForemanTasks.async_task(Actions::Pulp3::ContentGuard::RefreshAllDistributions, SmartProxy.pulp_primary)
|
|
20
24
|
until !task.pending? || task.paused?
|
|
21
25
|
sleep(10)
|
|
22
26
|
task = ForemanTasks::Task.find(task.id)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
load "#{Katello::Engine.root}/lib/katello/tasks/common.rake"
|
|
2
|
-
|
|
3
1
|
namespace :katello do
|
|
4
2
|
desc "Runs a Pulp 2 to 3 Content Migration for supported types. May be run multiple times. Use wait=false to immediately return with a task url."
|
|
5
|
-
task :pulp3_migration => ["
|
|
3
|
+
task :pulp3_migration => ["dynflow:client", 'check_config'] do
|
|
4
|
+
services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
|
|
5
|
+
Katello::Ping.ping!(services: services)
|
|
6
|
+
|
|
6
7
|
puts "Starting task."
|
|
7
8
|
SmartProxy.pulp_primary.refresh
|
|
8
9
|
|
|
@@ -10,6 +11,7 @@ namespace :katello do
|
|
|
10
11
|
wait = ::Foreman::Cast.to_bool(ENV['wait'] || 'true')
|
|
11
12
|
preserve_output = ::Foreman::Cast.to_bool(ENV['preserve_output'])
|
|
12
13
|
|
|
14
|
+
User.current = User.anonymous_api_admin
|
|
13
15
|
task = ForemanTasks.async_task(Actions::Pulp3::ContentMigration, SmartProxy.pulp_primary, reimport_all: reimport_all)
|
|
14
16
|
|
|
15
17
|
if wait
|
|
@@ -30,6 +32,13 @@ namespace :katello do
|
|
|
30
32
|
$stderr.print(msg)
|
|
31
33
|
fail ForemanTasks::TaskError, task
|
|
32
34
|
else
|
|
35
|
+
puts
|
|
36
|
+
Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
|
|
37
|
+
if type.missing_migrated_content.any?
|
|
38
|
+
puts "Some corrupted or missing content found, run 'foreman-maintain content migration-stats' for more information."
|
|
39
|
+
exit(-1)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
33
42
|
puts _("Content Migration completed successfully")
|
|
34
43
|
end
|
|
35
44
|
else
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
namespace :katello do
|
|
2
2
|
desc "Cancels all running Pulp 2 to 3 migration tasks."
|
|
3
|
-
task :pulp3_migration_abort => ["
|
|
3
|
+
task :pulp3_migration_abort => ["dynflow:client"] do
|
|
4
4
|
migration_tasks = ForemanTasks::Task::DynflowTask.where(:label => "Actions::Pulp3::ContentMigration").where.not(:state => ["stopped", "paused"])
|
|
5
5
|
cancelled_tasks_count = 0
|
|
6
6
|
migration_tasks.each do |task|
|