katello 3.18.0.rc2.1 → 3.18.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of katello might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/katello/katello.scss +0 -72
- data/app/controllers/katello/api/v2/api_controller.rb +1 -2
- data/app/controllers/katello/api/v2/capsule_content_controller.rb +2 -2
- data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +98 -0
- data/app/controllers/katello/api/v2/content_exports_controller.rb +84 -0
- data/app/controllers/katello/api/v2/content_imports_controller.rb +59 -0
- data/app/controllers/katello/api/v2/content_view_filters_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +56 -94
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +2 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +2 -0
- data/app/controllers/katello/concerns/api/v2/authorization.rb +14 -1
- data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +6 -2
- data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +7 -2
- data/app/lib/actions/katello/content_view/promote_to_environment.rb +1 -1
- data/app/lib/actions/katello/content_view/publish.rb +1 -1
- data/app/lib/actions/katello/content_view_version/import.rb +2 -1
- data/app/lib/actions/katello/content_view_version/import_library.rb +17 -0
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +19 -3
- data/app/lib/actions/katello/host/update_system_purpose.rb +1 -1
- data/app/lib/actions/katello/repository/sync.rb +5 -1
- data/app/lib/actions/middleware/record_smart_proxy_sync_history.rb +24 -4
- data/app/lib/actions/pulp3/content_migration.rb +10 -0
- data/app/lib/actions/pulp3/content_migration_presenter.rb +59 -0
- data/app/lib/actions/pulp3/content_migration_reset.rb +22 -0
- data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
- data/app/lib/actions/pulp3/content_view_version/export.rb +3 -2
- data/app/lib/actions/pulp3/import_migration.rb +6 -1
- data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +2 -1
- data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +17 -13
- data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +60 -0
- data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +0 -4
- data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +16 -3
- data/app/lib/actions/pulp3/repository/copy_content.rb +1 -1
- data/app/lib/actions/pulp3/repository/delete.rb +1 -1
- data/app/lib/actions/pulp3/repository/save_version.rb +1 -1
- data/app/lib/actions/pulp3/repository/upload_tag.rb +18 -0
- data/app/lib/katello/util/pulpcore_content_filters.rb +1 -1
- data/app/models/katello/authorization/content_view_version.rb +25 -2
- data/app/models/katello/authorization/content_view_version_export_history.rb +1 -1
- data/app/models/katello/authorization/organization.rb +8 -0
- data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -0
- data/app/models/katello/concerns/pulp_database_unit.rb +19 -0
- data/app/models/katello/concerns/redhat_extensions.rb +2 -2
- data/app/models/katello/concerns/smart_proxy_extensions.rb +7 -5
- data/app/models/katello/content_migration_progress.rb +4 -0
- data/app/models/katello/content_view.rb +5 -0
- data/app/models/katello/content_view_history.rb +2 -1
- data/app/models/katello/content_view_package_filter.rb +1 -1
- data/app/models/katello/content_view_version_export_history.rb +6 -1
- data/app/models/katello/file_unit.rb +4 -0
- data/app/models/katello/host/content_facet.rb +9 -31
- data/app/models/katello/host/subscription_facet.rb +4 -0
- data/app/models/katello/ping.rb +35 -15
- data/app/models/katello/repository.rb +7 -0
- data/app/models/katello/subscription_status.rb +3 -2
- data/app/services/katello/applicability/applicable_content_helper.rb +44 -15
- data/app/services/katello/pulp3/api/docker.rb +4 -0
- data/app/services/katello/pulp3/content_view_version/export.rb +63 -5
- data/app/services/katello/pulp3/content_view_version/import.rb +40 -0
- data/app/services/katello/pulp3/content_view_version/import_export_common.rb +0 -16
- data/app/services/katello/pulp3/content_view_version/import_validator.rb +26 -49
- data/app/services/katello/pulp3/docker_manifest.rb +1 -0
- data/app/services/katello/pulp3/docker_tag.rb +1 -0
- data/app/services/katello/pulp3/erratum.rb +2 -1
- data/app/services/katello/pulp3/migration.rb +95 -12
- data/app/services/katello/pulp3/migration_plan.rb +2 -2
- data/app/services/katello/pulp3/migration_switchover.rb +23 -5
- data/app/services/katello/pulp3/repository.rb +10 -5
- data/app/services/katello/pulp3/repository/docker.rb +5 -0
- data/app/services/katello/pulp3/repository/yum.rb +23 -8
- data/app/services/katello/pulp3/rpm.rb +5 -1
- data/app/services/katello/pulp3/task.rb +4 -0
- data/app/services/katello/pulp3/task_group.rb +4 -0
- data/app/views/katello/api/v2/content_views/show.json.rabl +6 -0
- data/app/views/katello/layouts/react.html.erb +3 -2
- data/app/views/katello/sync_management/_products.html.erb +1 -1
- data/app/views/overrides/activation_keys/_host_tab_pane.html.erb +1 -5
- data/config/routes/api/v2.rb +23 -3
- 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/20201119211133_pulp3_migration_progress.rb +9 -0
- data/db/migrate/20210201165835_add_migration_missing_content.rb +12 -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/content-views/deletion/content-view-version-deletion-activation-keys.controller.js +8 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-content-hosts.controller.js +9 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +4 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +78 -7
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +17 -20
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +17 -24
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +1292 -1170
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +17 -20
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +858 -807
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +18 -19
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +17 -24
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +17 -18
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +986 -971
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +19 -20
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -9
- data/lib/katello/permission_creator.rb +23 -3
- data/lib/katello/tasks/delete_orphaned_content.rake +1 -3
- data/lib/katello/tasks/pulp3_content_switchover.rake +3 -1
- data/lib/katello/tasks/pulp3_migration.rake +29 -6
- data/lib/katello/tasks/pulp3_migration_abort.rake +7 -2
- 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 +61 -8
- data/lib/katello/tasks/pulp3_post_migration_check.rake +1 -3
- data/lib/katello/tasks/receptor/extract_orgs.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/locale/action_names.rb +51 -51
- data/locale/bn/katello.po +136 -51
- data/locale/cs/katello.po +136 -49
- data/locale/de/katello.po +136 -48
- data/locale/en/katello.po +136 -48
- data/locale/es/katello.po +136 -48
- data/locale/fr/katello.po +136 -48
- data/locale/gu/katello.po +136 -51
- data/locale/hi/katello.po +136 -51
- data/locale/it/katello.po +136 -48
- data/locale/ja/katello.po +136 -48
- data/locale/katello.pot +941 -767
- data/locale/kn/katello.po +136 -51
- data/locale/ko/katello.po +136 -48
- data/locale/mr/katello.po +136 -51
- data/locale/or/katello.po +136 -51
- data/locale/pa/katello.po +136 -51
- data/locale/pt/katello.po +136 -51
- data/locale/pt_BR/katello.po +136 -48
- data/locale/ru/katello.po +136 -48
- data/locale/ta/katello.po +136 -51
- data/locale/te/katello.po +136 -51
- data/locale/zh_CN/katello.po +136 -48
- data/locale/zh_TW/katello.po +136 -48
- 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 +31 -19
- data/lib/katello/tasks/common.rake +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c5ad1aaf8a0bb032cc1ffd42c4c070c77cc538044396af1cd40db8d00132e58
|
4
|
+
data.tar.gz: fd418dbd20507da2ca47e937df543ccf1f5a2c8d254f17623aec03f0d5d2767b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b21464bd7f2341093cb31c47a6ee1792d508b8d16f6c9f47db4e8cffb3bc737f02aa1150e50cc05352c668db37eadc5fe708cd0d2705010fbd0072f46b887877
|
7
|
+
data.tar.gz: b67b69add02fae0357308a8301ac689814f2e32d835b5270c421d94cf46f6068b6398cd18cbb7da55913106deac0be816668939c605e7bf20d0a671740039402
|
@@ -163,78 +163,6 @@ input:focus {
|
|
163
163
|
@extend .status_exclamation_icon;
|
164
164
|
}
|
165
165
|
|
166
|
-
/* BUTTONS */
|
167
|
-
input[type='submit'], button, .button {
|
168
|
-
font-size: 10px;
|
169
|
-
display: inline-block;
|
170
|
-
vertical-align: bottom;
|
171
|
-
background: -moz-linear-gradient(top, #f9f9f9, #f0f0f0, #e5e5e5, #e9e9e9);
|
172
|
-
background: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), color-stop(0.9, #e5e5e5), to(#e9e9e9));
|
173
|
-
box-shadow: none;
|
174
|
-
border: 1px solid darken($stroke_color, 20%);
|
175
|
-
color: #221e1f;
|
176
|
-
cursor: pointer;
|
177
|
-
padding: 4px 8px;
|
178
|
-
border-radius: 5px;
|
179
|
-
text-shadow: 0 1px 0 rgba($white_color, 1);
|
180
|
-
min-height: 14px;
|
181
|
-
.nomargin {
|
182
|
-
margin: 0;
|
183
|
-
}
|
184
|
-
&:hover {
|
185
|
-
background: -moz-linear-gradient(top, $white_color, $white_color, #cfcfcf);
|
186
|
-
background: -webkit-gradient(linear, left top, left bottom, from($white_color), color-stop(0.6, $white_color), to(#cfcfcf));
|
187
|
-
box-shadow: 0 1px 2px rgba(0,0,0,0.5);
|
188
|
-
text-decoration: none;
|
189
|
-
color: black;
|
190
|
-
}
|
191
|
-
&:active {
|
192
|
-
background: -moz-linear-gradient(top, #c2c3c0, #e4e5e4);
|
193
|
-
background: -webkit-gradient(linear, left top, left bottom, from(#c2c3c0), to(#e4e5e4));
|
194
|
-
box-shadow: none;
|
195
|
-
text-decoration: none;
|
196
|
-
}
|
197
|
-
&:focus {
|
198
|
-
text-decoration: none;
|
199
|
-
color: #000;
|
200
|
-
border-width: 2px;
|
201
|
-
}
|
202
|
-
&.dialogbutton {
|
203
|
-
float: right;
|
204
|
-
margin-left: 3px;
|
205
|
-
margin: 40px 4px 4px;
|
206
|
-
}
|
207
|
-
&.formbutton {
|
208
|
-
display: inline-block;
|
209
|
-
margin-left: 3px;
|
210
|
-
margin: 40px 4px 4px;
|
211
|
-
}
|
212
|
-
&.actionlink {
|
213
|
-
margin: 40px 0 0;
|
214
|
-
}
|
215
|
-
&.disabled, &[disabled] {
|
216
|
-
cursor: default;
|
217
|
-
background: transparent;
|
218
|
-
opacity: 0.4;
|
219
|
-
|
220
|
-
&:hover {
|
221
|
-
background: transparent;
|
222
|
-
box-shadow: none;
|
223
|
-
}
|
224
|
-
}
|
225
|
-
&.iconbutton {
|
226
|
-
display: inline-block;
|
227
|
-
}
|
228
|
-
&.tiny {
|
229
|
-
padding: 4px;
|
230
|
-
margin: 0;
|
231
|
-
&:active, &:focus {
|
232
|
-
margin: 0;
|
233
|
-
padding: 3px;
|
234
|
-
}
|
235
|
-
}
|
236
|
-
}
|
237
|
-
|
238
166
|
table {
|
239
167
|
border-collapse: collapse;
|
240
168
|
border: 1px solid $stroke_color;
|
@@ -39,8 +39,7 @@ module Katello
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def deprecate_katello_agent
|
42
|
-
::Foreman::Deprecation.api_deprecation_warning("
|
43
|
-
"You may consider switching to Remote Execution.")
|
42
|
+
::Foreman::Deprecation.api_deprecation_warning("Katello-agent is deprecated and will be removed in a future release.")
|
44
43
|
end
|
45
44
|
|
46
45
|
def full_result_response(collection)
|
@@ -93,14 +93,14 @@ module Katello
|
|
93
93
|
|
94
94
|
def find_editable_capsule
|
95
95
|
@capsule = SmartProxy.unscoped.authorized(:manage_capsule_content).find(params[:id])
|
96
|
-
unless @capsule&.
|
96
|
+
unless @capsule&.pulp_mirror?
|
97
97
|
fail _("This request may only be performed on a Smart proxy that has the Pulp Node feature.")
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
def find_capsule
|
102
102
|
@capsule = SmartProxy.unscoped.authorized(:view_capsule_content).find(params[:id])
|
103
|
-
unless @capsule&.
|
103
|
+
unless @capsule&.pulp_mirror?
|
104
104
|
fail _("This request may only be performed on a Smart proxy that has the Pulp Node feature.")
|
105
105
|
end
|
106
106
|
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module Katello
|
2
|
+
class Api::V2::ContentExportIncrementalsController < Api::V2::ApiController
|
3
|
+
before_action :fail_if_not_pulp3, :only => [:version, :library]
|
4
|
+
before_action :find_exportable_organization, :only => [:library]
|
5
|
+
before_action :find_exportable_content_view_version, :only => [:version]
|
6
|
+
before_action :find_library_export_view, :only => [:library]
|
7
|
+
before_action :find_history, :only => [:version, :library]
|
8
|
+
|
9
|
+
api :POST, "/content_export_incrementals/version", N_("Performs an incremental-export of a content view version.")
|
10
|
+
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
11
|
+
param :destination_server, String, :desc => N_("Destination Server name"), :required => false
|
12
|
+
param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
|
13
|
+
"no greater than the specified size in megabytes."), :required => false
|
14
|
+
param :from_history_id, :number, :desc => N_("Export history identifier used for incremental export. "\
|
15
|
+
"If not provided the most recent export history will be used."), :required => false
|
16
|
+
param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this version"\
|
17
|
+
" are unexportable. False by default."), :required => false
|
18
|
+
def version
|
19
|
+
tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::Export,
|
20
|
+
content_view_version: @version,
|
21
|
+
destination_server: params[:destination_server],
|
22
|
+
chunk_size: params[:chunk_size_mb],
|
23
|
+
from_history: @history,
|
24
|
+
fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
|
25
|
+
|
26
|
+
respond_for_async :resource => tasks
|
27
|
+
end
|
28
|
+
|
29
|
+
api :POST, "/content_export_incrementals/library", N_("Performs an incremental-export of the repositories in library.")
|
30
|
+
param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
|
31
|
+
param :destination_server, String, :desc => N_("Destination Server name"), :required => false
|
32
|
+
param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
|
33
|
+
"no greater than the specified size in megabytes."), :required => false
|
34
|
+
param :from_history_id, :number, :desc => N_("Export history identifier used for incremental export. "\
|
35
|
+
"If not provided the most recent export history will be used."), :required => false
|
36
|
+
param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this organization"\
|
37
|
+
" are unexportable. False by default."), :required => false
|
38
|
+
def library
|
39
|
+
tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary,
|
40
|
+
@organization,
|
41
|
+
destination_server: params[:destination_server],
|
42
|
+
chunk_size: params[:chunk_size_mb],
|
43
|
+
from_history: @history,
|
44
|
+
fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
|
45
|
+
respond_for_async :resource => tasks
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def find_exportable_content_view_version
|
51
|
+
@version = ContentViewVersion.exportable.find_by_id(params[:id])
|
52
|
+
throw_resource_not_found(name: 'content view version', id: params[:id]) if @version.blank?
|
53
|
+
@view = @version.content_view
|
54
|
+
end
|
55
|
+
|
56
|
+
def find_library_export_view
|
57
|
+
@view = ::Katello::Pulp3::ContentViewVersion::Export.find_library_export_view(destination_server: params[:destination_server],
|
58
|
+
organization: @organization,
|
59
|
+
create_by_default: false)
|
60
|
+
if @view.blank?
|
61
|
+
msg = _("Unable to incrementally export. Do a Full Export the library content "\
|
62
|
+
"before updating from the latest increment.")
|
63
|
+
fail HttpErrors::BadRequest, msg
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def find_history
|
68
|
+
if params[:from_history_id].present?
|
69
|
+
@history = ::Katello::ContentViewVersionExportHistory.find(params[:from_history_id])
|
70
|
+
if @history.blank?
|
71
|
+
throw_resource_not_found(name: 'export history',
|
72
|
+
id: params[:from_history_id])
|
73
|
+
end
|
74
|
+
else
|
75
|
+
@history = ::Katello::ContentViewVersionExportHistory.
|
76
|
+
latest(@view,
|
77
|
+
destination_server: params[:destination_server])
|
78
|
+
if @history.blank?
|
79
|
+
msg = _("No existing export history was found to perform an incremental export. A full export must be performed")
|
80
|
+
fail HttpErrors::NotFound, msg
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def find_exportable_organization
|
86
|
+
find_organization
|
87
|
+
unless @organization.can_export_library_content?
|
88
|
+
throw_resource_not_found(name: 'organization', id: params[:organization_id])
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def fail_if_not_pulp3
|
93
|
+
unless SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE)
|
94
|
+
fail HttpErrors::BadRequest, _("Invalid usage for Pulp 2 repositories. Use export for Yum repositories")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Katello
|
2
|
+
class Api::V2::ContentExportsController < Api::V2::ApiController
|
3
|
+
before_action :fail_if_not_pulp3, :only => [:version, :library]
|
4
|
+
before_action :find_exportable_organization, :only => [:library]
|
5
|
+
before_action :find_exportable_content_view_version, :only => [:version]
|
6
|
+
|
7
|
+
api :GET, "/content_exports", N_("List export histories")
|
8
|
+
param :content_view_version_id, :number, :desc => N_("Content view version identifier"), :required => false
|
9
|
+
param :content_view_id, :number, :desc => N_("Content view identifier"), :required => false
|
10
|
+
param :destination_server, String, :desc => N_("Destination Server name"), :required => false
|
11
|
+
param :organization_id, :number, :desc => N_("Organization identifier"), :required => false
|
12
|
+
param :id, :number, :desc => N_("Content view version export history identifier"), :required => false
|
13
|
+
param_group :search, Api::V2::ApiController
|
14
|
+
add_scoped_search_description_for(ContentViewVersionExportHistory)
|
15
|
+
def index
|
16
|
+
history = ContentViewVersionExportHistory.readable
|
17
|
+
history = history.where(:id => params[:id]) unless params[:id].blank?
|
18
|
+
history = history.where(:content_view_version_id => params[:content_view_version_id]) unless params[:content_view_version_id].blank?
|
19
|
+
history = history.where(:destination_server => params[:destination_server]) unless params[:destination_server].blank?
|
20
|
+
history = history.with_organization_id(params[:organization_id]) unless params[:organization_id].blank?
|
21
|
+
history = history.with_content_view_id(params[:content_view_id]) unless params[:content_view_id].blank?
|
22
|
+
respond_with_template_collection("index", 'content_view_version_export_histories',
|
23
|
+
:collection => scoped_search(history, 'id', 'asc', resource_class: ContentViewVersionExportHistory))
|
24
|
+
end
|
25
|
+
|
26
|
+
api :GET, "/content_exports/api_status", N_("true if the export api is pulp3 ready and usable. This API is intended for use by hammer-cli only.")
|
27
|
+
def api_status
|
28
|
+
::Foreman::Deprecation.api_deprecation_warning("/content_exports/api_status is being deprecated and will be removed in a future version of Katello.")
|
29
|
+
render json: { api_usable: SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE) }, status: :ok
|
30
|
+
end
|
31
|
+
|
32
|
+
api :POST, "/content_exports/version", N_("Performs a full-export of a content view version.")
|
33
|
+
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
34
|
+
param :destination_server, String, :desc => N_("Destination Server name"), :required => false
|
35
|
+
param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
|
36
|
+
"no greater than the specified size in megabytes."), :required => false
|
37
|
+
param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this version"\
|
38
|
+
" are unexportable. False by default."), :required => false
|
39
|
+
def version
|
40
|
+
tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::Export,
|
41
|
+
content_view_version: @version,
|
42
|
+
destination_server: params[:destination_server],
|
43
|
+
chunk_size: params[:chunk_size_mb],
|
44
|
+
fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
|
45
|
+
respond_for_async :resource => tasks
|
46
|
+
end
|
47
|
+
|
48
|
+
api :POST, "/content_exports/library", N_("Performs a full-export of the repositories in library.")
|
49
|
+
param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
|
50
|
+
param :destination_server, String, :desc => N_("Destination Server name"), :required => false
|
51
|
+
param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
|
52
|
+
"no greater than the specified size in megabytes."), :required => false
|
53
|
+
param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this organization"\
|
54
|
+
" are unexportable. False by default."), :required => false
|
55
|
+
def library
|
56
|
+
tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary,
|
57
|
+
@organization,
|
58
|
+
destination_server: params[:destination_server],
|
59
|
+
chunk_size: params[:chunk_size_mb],
|
60
|
+
fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
|
61
|
+
respond_for_async :resource => tasks
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def find_exportable_content_view_version
|
67
|
+
@version = ContentViewVersion.exportable.find_by_id(params[:id])
|
68
|
+
throw_resource_not_found(name: 'content view version', id: params[:id]) if @version.blank?
|
69
|
+
end
|
70
|
+
|
71
|
+
def find_exportable_organization
|
72
|
+
find_organization
|
73
|
+
unless @organization.can_export_library_content?
|
74
|
+
throw_resource_not_found(name: 'organization', id: params[:organization_id])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def fail_if_not_pulp3
|
79
|
+
unless SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE)
|
80
|
+
fail HttpErrors::BadRequest, _("Invalid usage for Pulp 2 repositories. Use export for Yum repositories")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Katello
|
2
|
+
class Api::V2::ContentImportsController < Api::V2::ApiController
|
3
|
+
before_action :find_publishable_content_view, :only => [:version]
|
4
|
+
before_action :find_importable_organization, :only => [:library]
|
5
|
+
before_action :find_default_content_view, :only => [:library]
|
6
|
+
|
7
|
+
api :POST, "/content_imports/version", N_("Import a content view version")
|
8
|
+
param :content_view_id, :number, :desc => N_("Content view identifier"), :required => true
|
9
|
+
param :path, String, :desc => N_("Directory containing the exported Content View Version"), :required => true
|
10
|
+
param :metadata, Hash, :desc => N_("Metadata taken from the upstream export history for this Content View Version"), :required => true
|
11
|
+
def version
|
12
|
+
if @view.default?
|
13
|
+
fail HttpErrors::BadRequest, _("Cannot use this end point for importing to library. "\
|
14
|
+
"If you intented to upload to library, use the library endpoint.")
|
15
|
+
end
|
16
|
+
|
17
|
+
task = async_task(::Actions::Katello::ContentViewVersion::Import, @view, path: params[:path], metadata: metadata_params.to_h)
|
18
|
+
respond_for_async :resource => task
|
19
|
+
end
|
20
|
+
|
21
|
+
api :POST, "/content_imports/library", N_("Import a content view version to the library")
|
22
|
+
param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
|
23
|
+
param :path, String, :desc => N_("Directory containing the exported Content View Version"), :required => true
|
24
|
+
param :metadata, Hash, :desc => N_("Metadata taken from the upstream export history for this Content View Version"), :required => true
|
25
|
+
def library
|
26
|
+
task = async_task(::Actions::Katello::ContentViewVersion::ImportLibrary, @organization, path: params[:path], metadata: metadata_params.to_h)
|
27
|
+
respond_for_async :resource => task
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def find_publishable_content_view
|
33
|
+
@view = ContentView.publishable.find(params[:content_view_id])
|
34
|
+
throw_resource_not_found(name: 'content_view', id: params[:content_view_id]) if @view.blank?
|
35
|
+
end
|
36
|
+
|
37
|
+
def find_default_content_view
|
38
|
+
@view = @organization&.default_content_view
|
39
|
+
throw_resource_not_found(name: 'organization', id: params[:organization_id]) if @view.blank?
|
40
|
+
end
|
41
|
+
|
42
|
+
def find_importable_organization
|
43
|
+
find_organization
|
44
|
+
throw_resource_not_found(name: 'organization', id: params[:organization_id]) unless @organization.can_import_library_content?
|
45
|
+
end
|
46
|
+
|
47
|
+
def metadata_params
|
48
|
+
params.require(:metadata).permit(
|
49
|
+
:organization,
|
50
|
+
:content_view,
|
51
|
+
:repository_mapping,
|
52
|
+
:toc,
|
53
|
+
content_view_version: [:major, :minor]
|
54
|
+
).tap do |nested|
|
55
|
+
nested[:repository_mapping] = params[:metadata].require(:repository_mapping).permit!
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -73,7 +73,7 @@ module Katello
|
|
73
73
|
respond :resource => @filter
|
74
74
|
end
|
75
75
|
|
76
|
-
api :
|
76
|
+
api :delete, "/content_views/:content_view_id/filters/:id", N_("delete a filter")
|
77
77
|
api :delete, "/content_view_filters/:id", N_("delete a filter")
|
78
78
|
param :content_view_id, :number, :desc => N_("content view identifier")
|
79
79
|
param :id, :number, :desc => N_("filter identifier"), :required => true
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module Katello
|
2
|
-
# rubocop:disable Metrics/ClassLength
|
3
2
|
class Api::V2::ContentViewVersionsController < Api::V2::ApiController
|
4
3
|
include Concerns::Api::V2::BulkHostsExtensions
|
5
4
|
include Katello::Concerns::FilteredAutoCompleteSearch
|
6
5
|
|
7
|
-
before_action :
|
8
|
-
before_action :
|
6
|
+
before_action :find_authorized_katello_resource, :only => [:show, :update, :promote, :destroy, :export, :republish_repositories]
|
7
|
+
before_action :find_content_view_from_version, :only => [:show, :update, :promote, :destroy, :export, :republish_repositories]
|
8
|
+
before_action :find_optional_readable_content_view, :only => [:index]
|
9
|
+
before_action :find_publishable_content_view, :only => [:import]
|
10
|
+
|
9
11
|
before_action :find_environment, :only => [:index]
|
10
12
|
before_action :find_environments, :only => [:promote]
|
11
13
|
before_action :validate_promotable, :only => [:promote]
|
@@ -47,7 +49,7 @@ module Katello
|
|
47
49
|
api :GET, "/content_view_versions/:id", N_("Show content view version")
|
48
50
|
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
49
51
|
def show
|
50
|
-
respond :resource => @
|
52
|
+
respond :resource => @content_view_version
|
51
53
|
end
|
52
54
|
|
53
55
|
api :POST, "/content_view_versions/:id/promote", N_("Promote a content view version")
|
@@ -58,7 +60,7 @@ module Katello
|
|
58
60
|
def promote
|
59
61
|
is_force = ::Foreman::Cast.to_bool(params[:force])
|
60
62
|
task = async_task(::Actions::Katello::ContentView::Promote,
|
61
|
-
@
|
63
|
+
@content_view_version, @environments, is_force, params[:description])
|
62
64
|
respond_for_async :resource => task
|
63
65
|
end
|
64
66
|
|
@@ -66,59 +68,54 @@ module Katello
|
|
66
68
|
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
67
69
|
param :description, String, :desc => N_("The description for the content view version"), :required => true
|
68
70
|
def update
|
69
|
-
history = @
|
71
|
+
history = @content_view_version.history.publish.successful.first
|
70
72
|
if history.blank?
|
71
73
|
fail HttpErrors::BadRequest, _("This content view version doesn't have a history.")
|
72
74
|
else
|
73
75
|
history.notes = params[:description]
|
74
76
|
history.save!
|
75
|
-
respond_for_show(:resource => @
|
77
|
+
respond_for_show(:resource => @content_view_version)
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
79
81
|
api :PUT, "/content_view_versions/:id/republish_repositories", N_("Forces a republish of the version's repositories' metadata")
|
80
82
|
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
81
83
|
def republish_repositories
|
82
|
-
task = async_task(::Actions::Katello::ContentViewVersion::RepublishRepositories, @
|
84
|
+
task = async_task(::Actions::Katello::ContentViewVersion::RepublishRepositories, @content_view_version)
|
83
85
|
respond_for_async :resource => task
|
84
86
|
end
|
85
87
|
|
86
|
-
api :
|
87
|
-
param :content_view_version_id, :number, :desc => N_("Content view version identifier"), :required => false
|
88
|
-
param :content_view_id, :number, :desc => N_("Content view identifier"), :required => false
|
89
|
-
param :destination_server, String, :desc => N_("Destination Server name"), :required => false
|
90
|
-
param :organization_id, :number, :desc => N_("Organization identifier"), :required => false
|
91
|
-
param_group :search, Api::V2::ApiController
|
92
|
-
add_scoped_search_description_for(ContentViewVersionExportHistory)
|
93
|
-
def export_histories
|
94
|
-
history = ContentViewVersionExportHistory.readable
|
95
|
-
history = history.where(:content_view_version_id => params[:content_view_version_id]) unless params[:content_view_version_id].blank?
|
96
|
-
history = history.where(:destination_server => params[:destination_server]) unless params[:destination_server].blank?
|
97
|
-
history = history.with_organization_id(params[:organization_id]) unless params[:organization_id].blank?
|
98
|
-
history = history.with_content_view_id(params[:content_view_id]) unless params[:content_view_id].blank?
|
99
|
-
respond_for_index(:collection => scoped_search(history, 'id', 'asc', resource_class: ContentViewVersionExportHistory),
|
100
|
-
:template => '../../../api/v2/content_view_version_export_histories/index')
|
101
|
-
end
|
102
|
-
|
103
|
-
api :GET, "/content_view_versions/export_api_status", N_("true if the export api is pulp3 ready and usable. This API is intended for use by hammer-cli only.")
|
104
|
-
def export_api_status
|
105
|
-
::Foreman::Deprecation.api_deprecation_warning("export_api_status is being deprecated and will be removed in a future version of Katello.")
|
106
|
-
render json: { api_usable: SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE) }, status: :ok
|
107
|
-
end
|
108
|
-
|
109
|
-
api :POST, "/content_view_versions/:id/export", N_("Export a content view version")
|
88
|
+
api :POST, "/content_view_versions/:id/export", N_("Export a content view version. Relevant only for Pulp 2 repositories.")
|
110
89
|
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
111
|
-
param :
|
112
|
-
param :chunk_size_mb, :number, :desc => N_("Chunk export-tarfile into pieces of chunk_size mega bytes. Relevant only for Pulp 3 repositories"), :required => false
|
113
|
-
param :export_to_iso, :bool, :desc => N_("Export to ISO format. Relevant only for Pulp 2 repositories"), :required => false
|
90
|
+
param :export_to_iso, :bool, :desc => N_("Export to ISO format."), :required => false
|
114
91
|
param :iso_mb_size, :number, :desc => N_("maximum size of each ISO in MB. Relevant only for Pulp 2 repositories"), :required => false
|
115
92
|
param :since, Date, :desc => N_("Optional date of last export (ex: 2010-01-01T12:00:00Z). Relevant only for Pulp 2 repositories"), :required => false
|
116
93
|
def export
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
94
|
+
if SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE)
|
95
|
+
fail HttpErrors::BadRequest, _("Invalid usage for Pulp 3 repositories. "\
|
96
|
+
"Use hammer content-export for Yum repositories")
|
97
|
+
end
|
98
|
+
::Foreman::Deprecation.api_deprecation_warning("Export is being deprecated and will be removed in a future version of Katello. Use hammer content-view version export instead.")
|
99
|
+
if params[:export_to_iso].blank? && params[:iso_mb_size].present?
|
100
|
+
fail HttpErrors::BadRequest, _("ISO export must be enabled when specifying ISO size")
|
101
|
+
end
|
102
|
+
|
103
|
+
if (repos = @content_view_version.content_view.on_demand_repositories).any?
|
104
|
+
fail HttpErrors::BadRequest, _("This content view has on demand repositories that cannot be exported: %{repos}" % {repos: repos.pluck(:label).join(", ")})
|
105
|
+
end
|
106
|
+
|
107
|
+
if params[:since].present?
|
108
|
+
begin
|
109
|
+
params[:since].to_datetime
|
110
|
+
rescue
|
111
|
+
raise HttpErrors::BadRequest, _("Invalid date provided.")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
task = async_task(::Actions::Katello::ContentViewVersion::Export, @content_view_version,
|
115
|
+
::Foreman::Cast.to_bool(params[:export_to_iso]),
|
116
|
+
params[:since].try(:to_datetime),
|
117
|
+
params[:iso_mb_size])
|
118
|
+
|
122
119
|
respond_for_async :resource => task
|
123
120
|
end
|
124
121
|
|
@@ -134,7 +131,7 @@ module Katello
|
|
134
131
|
api :DELETE, "/content_view_versions/:id", N_("Remove content view version")
|
135
132
|
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
136
133
|
def destroy
|
137
|
-
task = async_task(::Actions::Katello::ContentViewVersion::Destroy, @
|
134
|
+
task = async_task(::Actions::Katello::ContentViewVersion::Destroy, @content_view_version)
|
138
135
|
respond_for_async :resource => task
|
139
136
|
end
|
140
137
|
|
@@ -174,7 +171,7 @@ module Katello
|
|
174
171
|
|
175
172
|
validate_content(params[:add_content])
|
176
173
|
resolve_dependencies = params.fetch(:resolve_dependencies, true)
|
177
|
-
task = async_task(::Actions::Katello::ContentView::IncrementalUpdates, @
|
174
|
+
task = async_task(::Actions::Katello::ContentView::IncrementalUpdates, @content_view_version_environments, @composite_version_environments,
|
178
175
|
params[:add_content], resolve_dependencies, hosts, params[:description])
|
179
176
|
respond_for_async :resource => task
|
180
177
|
end
|
@@ -200,17 +197,22 @@ module Katello
|
|
200
197
|
find_bulk_hosts(:edit_hosts, params[:update_hosts], restrict_hosts)
|
201
198
|
end
|
202
199
|
|
203
|
-
def
|
204
|
-
@
|
205
|
-
end
|
206
|
-
|
207
|
-
def find_content_view
|
208
|
-
@view = @version ? @version.content_view : ContentView.where(:id => params[:content_view_id]).first
|
200
|
+
def find_content_view_from_version
|
201
|
+
@view = @content_view_version.content_view
|
209
202
|
if @view&.default? && params[:action] == "promote"
|
210
203
|
fail HttpErrors::BadRequest, _("The default content view cannot be promoted")
|
211
204
|
end
|
212
205
|
end
|
213
206
|
|
207
|
+
def find_optional_readable_content_view
|
208
|
+
@view = ContentView.readable.find_by(:id => params[:content_view_id])
|
209
|
+
end
|
210
|
+
|
211
|
+
def find_publishable_content_view
|
212
|
+
@view = ContentView.publishable.find_by(:id => params[:content_view_id])
|
213
|
+
throw_resource_not_found(name: 'product', id: params[:product_id]) if @view.nil?
|
214
|
+
end
|
215
|
+
|
214
216
|
def find_version_environments
|
215
217
|
#Generates a data structure for incremental update:
|
216
218
|
# [{:content_view_version => ContentViewVersion, :environments => [KTEnvironment]}]
|
@@ -218,7 +220,7 @@ module Katello
|
|
218
220
|
list = params[:content_view_version_environments]
|
219
221
|
fail _("At least one Content View Version must be specified") if list.empty?
|
220
222
|
|
221
|
-
@
|
223
|
+
@content_view_version_environments = []
|
222
224
|
@composite_version_environments = []
|
223
225
|
list.each do |combination|
|
224
226
|
version_environment = {
|
@@ -242,7 +244,7 @@ module Katello
|
|
242
244
|
if view.composite?
|
243
245
|
@composite_version_environments << version_environment
|
244
246
|
else
|
245
|
-
@
|
247
|
+
@content_view_version_environments << version_environment
|
246
248
|
@composite_version_environments += lookup_all_composites(version_environment[:content_view_version]) if params[:propagate_all_composites]
|
247
249
|
end
|
248
250
|
end
|
@@ -261,7 +263,7 @@ module Katello
|
|
261
263
|
def find_version_environments_for_hosts(include_composites)
|
262
264
|
if include_composites
|
263
265
|
version_environments_for_systems_map = {}
|
264
|
-
@
|
266
|
+
@content_view_version_environments.each do |version_environment|
|
265
267
|
version_environment[:content_view_version].composites.each do |composite_version|
|
266
268
|
version_environments_for_systems_map[composite_version.id] ||= {:content_view_version => composite_version,
|
267
269
|
:environments => composite_version.environments}
|
@@ -270,7 +272,7 @@ module Katello
|
|
270
272
|
|
271
273
|
version_environments_for_systems_map.values
|
272
274
|
else
|
273
|
-
@
|
275
|
+
@content_view_version_environments.select { |ve| !ve[:environments].blank? }
|
274
276
|
end
|
275
277
|
end
|
276
278
|
|
@@ -313,55 +315,15 @@ module Katello
|
|
313
315
|
|
314
316
|
def validate_promotable
|
315
317
|
fail HttpErrors::BadRequest, _("Could not find environments for promotion") if @environments.blank?
|
316
|
-
return deny_access unless @environments.all?(&:promotable_or_removable?) && @
|
318
|
+
return deny_access unless @environments.all?(&:promotable_or_removable?) && @content_view_version.content_view.promotable_or_removable?
|
317
319
|
true
|
318
320
|
end
|
319
321
|
|
320
322
|
def authorize_destroy
|
321
|
-
return deny_access unless @
|
323
|
+
return deny_access unless @content_view_version.content_view.deletable?
|
322
324
|
true
|
323
325
|
end
|
324
326
|
|
325
|
-
def export_pulp_v2
|
326
|
-
::Foreman::Deprecation.api_deprecation_warning("Export is being deprecated and will be removed in a future version of Katello. Use hammer content-view version export instead.")
|
327
|
-
if params[:export_to_iso].blank? && params[:iso_mb_size].present?
|
328
|
-
fail HttpErrors::BadRequest, _("ISO export must be enabled when specifying ISO size")
|
329
|
-
end
|
330
|
-
|
331
|
-
if (repos = @version.content_view.on_demand_repositories).any?
|
332
|
-
fail HttpErrors::BadRequest, _("This content view has on demand repositories that cannot be exported: %{repos}" % {repos: repos.pluck(:label).join(", ")})
|
333
|
-
end
|
334
|
-
|
335
|
-
if params[:since].present?
|
336
|
-
begin
|
337
|
-
params[:since].to_datetime
|
338
|
-
rescue
|
339
|
-
raise HttpErrors::BadRequest, _("Invalid date provided.")
|
340
|
-
end
|
341
|
-
end
|
342
|
-
async_task(::Actions::Katello::ContentViewVersion::Export, @version,
|
343
|
-
::Foreman::Cast.to_bool(params[:export_to_iso]),
|
344
|
-
params[:since].try(:to_datetime),
|
345
|
-
params[:iso_mb_size])
|
346
|
-
end
|
347
|
-
|
348
|
-
def export_pulp_v3
|
349
|
-
invalid_params = [:export_to_iso, :iso_mb_size, :since].reject { |param| params[param].blank? }
|
350
|
-
unless invalid_params.empty?
|
351
|
-
fail HttpErrors::BadRequest, _("Invalid parameters provided - %{params}. These are only relevant for Pulp 2 repositories" % { params: invalid_params.join(', ')})
|
352
|
-
end
|
353
|
-
|
354
|
-
if params[:destination_server].blank?
|
355
|
-
fail HttpErrors::BadRequest, _("Destination Server Name required for Pulp3 repositories")
|
356
|
-
end
|
357
|
-
|
358
|
-
history = ::Katello::ContentViewVersionExportHistory.find(params[:from_history_id]) unless params[:from_history_id].blank?
|
359
|
-
|
360
|
-
async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::Export, @version, destination_server: params[:destination_server],
|
361
|
-
chunk_size: params[:chunk_size_mb],
|
362
|
-
from_history: history)
|
363
|
-
end
|
364
|
-
|
365
327
|
def metadata_params
|
366
328
|
params.require(:metadata).permit(
|
367
329
|
:organization,
|