katello 4.2.0.rc2 → 4.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/javascripts/katello/hosts/host_and_hostgroup_edit.js +6 -3
- data/app/controllers/katello/api/v2/content_uploads_controller.rb +6 -3
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +2 -1
- data/app/controllers/katello/api/v2/generic_content_units_controller.rb +26 -0
- data/app/controllers/katello/api/v2/repositories_controller.rb +16 -4
- data/app/helpers/katello/content_view_helper.rb +4 -4
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +18 -11
- data/app/lib/actions/katello/activation_key/destroy.rb +1 -1
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +7 -47
- data/app/lib/actions/katello/content_view/incremental_updates.rb +13 -3
- data/app/lib/actions/katello/content_view/promote_to_environment.rb +2 -7
- data/app/lib/actions/katello/content_view/publish.rb +7 -6
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +4 -4
- data/app/lib/actions/katello/environment/publish_repositories.rb +1 -0
- data/app/lib/actions/katello/repository/filtered_index_content.rb +5 -0
- data/app/lib/actions/katello/repository/import_upload.rb +5 -1
- data/app/lib/actions/katello/repository/index_content.rb +2 -1
- data/app/lib/actions/katello/repository/instance_update.rb +1 -1
- data/app/lib/actions/katello/repository/multi_clone_to_version.rb +1 -1
- data/app/lib/actions/katello/repository/remove_content.rb +5 -1
- data/app/lib/actions/katello/repository/upload_files.rb +6 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +16 -3
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +2 -2
- data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +2 -4
- data/app/lib/actions/pulp3/orchestration/repository/upload_content.rb +2 -7
- data/app/lib/actions/pulp3/repository/save_artifact.rb +4 -1
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +1 -1
- data/app/lib/katello/qpid/connection.rb +3 -1
- data/app/lib/katello/util/errata.rb +9 -2
- data/app/lib/katello/util/pulpcore_content_filters.rb +1 -0
- data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +27 -14
- data/app/models/katello/concerns/host_managed_extensions.rb +19 -0
- data/app/models/katello/concerns/hostgroup_extensions.rb +4 -4
- data/app/models/katello/concerns/pulp_database_unit.rb +32 -11
- data/app/models/katello/concerns/redhat_extensions.rb +3 -2
- data/app/models/katello/concerns/smart_proxy_extensions.rb +39 -4
- data/app/models/katello/content_view.rb +13 -0
- data/app/models/katello/content_view_repository.rb +1 -1
- data/app/models/katello/docker_tag.rb +2 -2
- data/app/models/katello/erratum.rb +13 -0
- data/app/models/katello/generic_content_unit.rb +4 -1
- data/app/models/katello/repository.rb +15 -7
- data/app/models/katello/root_repository.rb +9 -2
- data/app/models/katello/yum_metadata_file.rb +2 -2
- data/app/overrides/add_activation_keys_input.rb +1 -1
- data/app/services/katello/applicability/applicable_content_helper.rb +4 -3
- data/app/services/katello/pulp/content.rb +1 -1
- data/app/services/katello/pulp3/content.rb +6 -2
- data/app/services/katello/pulp3/erratum.rb +12 -4
- data/app/services/katello/pulp3/generic_content_unit.rb +1 -1
- data/app/services/katello/pulp3/package_group.rb +10 -10
- data/app/services/katello/pulp3/pulp_content_unit.rb +26 -1
- data/app/services/katello/pulp3/repository/apt.rb +16 -0
- data/app/services/katello/pulp3/repository/yum.rb +29 -47
- data/app/services/katello/pulp3/repository.rb +19 -16
- data/app/services/katello/pulp3/repository_mirror.rb +10 -2
- data/app/services/katello/pulp3/task.rb +3 -2
- data/app/services/katello/pulp3/task_group.rb +1 -0
- data/app/services/katello/repository_type.rb +8 -6
- data/app/services/katello/repository_type_manager.rb +25 -22
- data/app/views/katello/api/v2/generic_content_units/base.json.rabl +7 -0
- data/app/views/katello/api/v2/generic_content_units/compare.json.rabl +10 -0
- data/app/views/katello/api/v2/generic_content_units/index.json.rabl +7 -0
- data/app/views/katello/api/v2/generic_content_units/show.json.rabl +3 -0
- data/app/views/katello/api/v2/repositories/show.json.rabl +2 -1
- data/app/views/overrides/activation_keys/_host_environment_select.html.erb +3 -3
- data/config/initializers/filter_parameters.rb +1 -0
- data/config/routes/api/v2.rb +12 -1
- data/db/migrate/20210512192745_fix_red_hat_root_repository_arch.rb +1 -1
- data/db/migrate/20210831161843_add_upstream_auth_token_to_root_repository.rb +5 -0
- data/db/seeds.d/111-upgrade_tasks.rb +3 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +6 -13
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +3 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +6 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +11 -0
- data/lib/katello/permission_creator.rb +2 -0
- data/lib/katello/repository_types/deb.rb +1 -1
- data/lib/katello/repository_types/docker.rb +1 -1
- data/lib/katello/repository_types/file.rb +1 -1
- data/lib/katello/repository_types/ostree.rb +1 -1
- data/lib/katello/repository_types/python.rb +4 -1
- data/lib/katello/repository_types/yum.rb +1 -1
- data/lib/katello/tasks/reset.rake +6 -5
- data/lib/katello/tasks/test.rake +1 -2
- data/lib/katello/tasks/upgrades/4.1/{update_content_import_export_perms.rake → reupdate_content_import_export_perms.rake} +24 -1
- data/lib/katello/tasks/upgrades/4.2/remove_checksum_values.rake +17 -0
- data/lib/katello/version.rb +1 -1
- data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/ActivationKeys.test.js.snap +1 -0
- data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/Force.test.js.snap +1 -0
- data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/IgnoreSubmanErrors.test.js.snap +1 -0
- data/webpack/scenes/RedHatRepositories/components/SearchBar.js +2 -4
- metadata +23 -31
- data/locale/bn/katello.po.time_stamp +0 -0
- data/locale/cs/katello.po.time_stamp +0 -0
- data/locale/de/katello.po.time_stamp +0 -0
- data/locale/en/katello.po.time_stamp +0 -0
- data/locale/es/katello.po.time_stamp +0 -0
- data/locale/fr/katello.po.time_stamp +0 -0
- data/locale/gu/katello.po.time_stamp +0 -0
- data/locale/hi/katello.po.time_stamp +0 -0
- data/locale/it/katello.po.time_stamp +0 -0
- data/locale/ja/katello.po.time_stamp +0 -0
- data/locale/kn/katello.po.time_stamp +0 -0
- data/locale/ko/katello.po.time_stamp +0 -0
- data/locale/mr/katello.po.time_stamp +0 -0
- data/locale/or/katello.po.time_stamp +0 -0
- data/locale/pa/katello.po.time_stamp +0 -0
- data/locale/pt/katello.po.time_stamp +0 -0
- data/locale/pt_BR/katello.po.time_stamp +0 -0
- data/locale/ru/katello.po.time_stamp +0 -0
- data/locale/ta/katello.po.time_stamp +0 -0
- data/locale/te/katello.po.time_stamp +0 -0
- data/locale/zh_CN/katello.po.time_stamp +0 -0
- data/locale/zh_TW/katello.po.time_stamp +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86442b066cfb028bec4edcd99bc079e29675037545b33af48336a8e176ffc43d
|
4
|
+
data.tar.gz: 9cbab83302f8791feafc1912bc7c81ea31d4d08169d1f554cfc1361f995941e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4c1529274b2d229ac784ccdad9f3c9b90b67f92df7eca9d8228e79e675bbcfb9766c33b4af3bbad3b87524c4cee1cdb13e607cd9a39f5d3aa5d865d032bee02
|
7
|
+
data.tar.gz: 62a2813d45436694cce0f721d26d0ec2782f112e9154cfa051ed650b4aa2d86dd4624708a835f03adca3b65280ccbabccfa3d83d506224e8616eeedb6d8aec4c
|
@@ -4,7 +4,7 @@ KT.hosts = {};
|
|
4
4
|
$(document).on('ContentLoad', function(){
|
5
5
|
KT.hosts.onKatelloHostEditLoad();
|
6
6
|
window.tfm.hosts.registerPluginAttributes("os",
|
7
|
-
['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id']);
|
7
|
+
['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id', 'parent_id']);
|
8
8
|
|
9
9
|
$("#hostgroup_lifecycle_environment_id").change(KT.hosts.environmentChanged);
|
10
10
|
$("#host_lifecycle_environment_id").change(KT.hosts.environmentChanged);
|
@@ -27,13 +27,15 @@ KT.hosts.fetchContentViews = function () {
|
|
27
27
|
var envId = KT.hosts.getSelectedEnvironment();
|
28
28
|
var option;
|
29
29
|
var previous_view = KT.hosts.getSelectedContentView();
|
30
|
-
|
30
|
+
var previousInheritViewText = select.find('option:first-child').text();
|
31
31
|
select.find('option').remove();
|
32
32
|
if (envId) {
|
33
33
|
KT.hosts.signalContentViewFetch(true);
|
34
34
|
var url = tfm.tools.foremanUrl('/katello/api/v2/content_views/');
|
35
35
|
$.get(url, {environment_id: envId, full_result: true}, function (data) {
|
36
|
-
|
36
|
+
if ($('#hostgroup_parent_id').length > 0) {
|
37
|
+
select.append($("<option />").text(previousInheritViewText).val(''));
|
38
|
+
}
|
37
39
|
$.each(data.results, function(index, view) {
|
38
40
|
option = $("<option />").val(view.id).text(view.name);
|
39
41
|
if (view.id === parseInt(previous_view)) {
|
@@ -41,6 +43,7 @@ KT.hosts.fetchContentViews = function () {
|
|
41
43
|
}
|
42
44
|
select.append(option);
|
43
45
|
});
|
46
|
+
select.trigger('change');
|
44
47
|
KT.hosts.signalContentViewFetch(false);
|
45
48
|
});
|
46
49
|
}
|
@@ -15,9 +15,12 @@ module Katello
|
|
15
15
|
fail Katello::Errors::InvalidRepositoryContent, _("Cannot upload Ansible collections.") if @repository.ansible_collection?
|
16
16
|
content_type = params[:content_type] || ::Katello::RepositoryTypeManager.find(@repository.content_type)&.default_managed_content_type&.label
|
17
17
|
RepositoryTypeManager.check_content_matches_repo_type!(@repository, content_type)
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
if ::Katello::RepositoryTypeManager.generic_content_type?(content_type)
|
19
|
+
unit_type_id = content_type
|
20
|
+
else
|
21
|
+
unit_type_id = SmartProxy.pulp_primary.content_service(content_type).content_type
|
22
|
+
end
|
23
|
+
render :json => @repository.backend_content_service(::SmartProxy.pulp_primary).create_upload(params[:size], params[:checksum], unit_type_id, @repository)
|
21
24
|
end
|
22
25
|
|
23
26
|
api :PUT, "/repositories/:repository_id/content_uploads/:id", N_("Upload a chunk of the file's content")
|
@@ -124,7 +124,8 @@ module Katello
|
|
124
124
|
validate_content(params[:add_content])
|
125
125
|
resolve_dependencies = params.fetch(:resolve_dependencies, true)
|
126
126
|
task = async_task(::Actions::Katello::ContentView::IncrementalUpdates, @content_view_version_environments, @composite_version_environments,
|
127
|
-
params[:add_content], resolve_dependencies, hosts, params[:description]
|
127
|
+
params[:add_content], resolve_dependencies, hosts, params[:description],
|
128
|
+
Setting[:remote_execution_by_default] && ::Katello.with_remote_execution?)
|
128
129
|
respond_for_async :resource => task
|
129
130
|
end
|
130
131
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Katello
|
2
|
+
class Api::V2::GenericContentUnitsController < Api::V2::ApiController
|
3
|
+
Katello::RepositoryTypeManager.generic_content_types(enabled_only: false).each do |type|
|
4
|
+
apipie_concern_subst(:a_resource => N_(type), :resource_id => type.pluralize)
|
5
|
+
resource_description do
|
6
|
+
name type.pluralize.titleize
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
include Katello::Concerns::Api::V2::RepositoryContentController
|
11
|
+
|
12
|
+
def default_sort
|
13
|
+
%w(name asc)
|
14
|
+
end
|
15
|
+
|
16
|
+
def resource_class
|
17
|
+
::Katello::GenericContentUnit.where(content_type: params[:content_type].singularize)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def repo_association
|
23
|
+
:repository_id
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -56,6 +56,7 @@ module Katello
|
|
56
56
|
param :verify_ssl_on_sync, :bool, :desc => N_("if true, Katello will verify the upstream url's SSL certifcates are signed by a trusted CA")
|
57
57
|
param :upstream_username, String, :desc => N_("Username of the upstream repository user used for authentication")
|
58
58
|
param :upstream_password, String, :desc => N_("Password of the upstream repository user used for authentication")
|
59
|
+
param :upstream_authentication_token, String, :desc => N_("Password of the upstream authentication token.")
|
59
60
|
param :ostree_upstream_sync_policy, ::Katello::RootRepository::OSTREE_UPSTREAM_SYNC_POLICIES, :desc => N_("policies for syncing upstream ostree repositories")
|
60
61
|
param :ostree_upstream_sync_depth, :number, :desc => N_("if a custom sync policy is chosen for ostree repositories then a 'depth' value must be provided")
|
61
62
|
param :deb_releases, String, :desc => N_("whitespace-separated list of releases to be synced from deb-archive")
|
@@ -462,10 +463,11 @@ module Katello
|
|
462
463
|
|
463
464
|
# rubocop:disable Metrics/CyclomaticComplexity
|
464
465
|
def repository_params
|
465
|
-
keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password,
|
466
|
+
keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password,
|
467
|
+
:upstream_username, :download_concurrency, :upstream_authentication_token,
|
466
468
|
:ostree_upstream_sync_depth, :ostree_upstream_sync_policy, {:os_versions => []},
|
467
|
-
:deb_releases, :deb_components, :deb_architectures, :description, :http_proxy_policy,
|
468
|
-
{:ignorable_content => []}
|
469
|
+
:deb_releases, :deb_components, :deb_architectures, :description, :http_proxy_policy,
|
470
|
+
:http_proxy_id, :retain_package_versions_count, {:ignorable_content => []}
|
469
471
|
]
|
470
472
|
|
471
473
|
keys += [{:docker_tags_whitelist => []}, :docker_upstream_name] if params[:action] == 'create' || @repository&.docker?
|
@@ -512,6 +514,7 @@ module Katello
|
|
512
514
|
root.verify_ssl_on_sync = ::Foreman::Cast.to_bool(repo_params[:verify_ssl_on_sync]) if repo_params.key?(:verify_ssl_on_sync)
|
513
515
|
root.upstream_username = repo_params[:upstream_username] if repo_params.key?(:upstream_username)
|
514
516
|
root.upstream_password = repo_params[:upstream_password] if repo_params.key?(:upstream_password)
|
517
|
+
root.upstream_authentication_token = repo_params[:upstream_authentication_token] if repo_params.key?(:upstream_authentication_token)
|
515
518
|
root.ignorable_content = repo_params[:ignorable_content] if root.yum? && repo_params.key?(:ignorable_content)
|
516
519
|
root.http_proxy_policy = repo_params[:http_proxy_policy] if repo_params.key?(:http_proxy_policy)
|
517
520
|
root.http_proxy_id = repo_params[:http_proxy_id] if repo_params.key?(:http_proxy_id)
|
@@ -563,12 +566,21 @@ module Katello
|
|
563
566
|
content_type = params[:content_type]
|
564
567
|
|
565
568
|
if content_type
|
569
|
+
RepositoryTypeManager.check_content_matches_repo_type!(@repository, params[:content_type]) if params[:content_type]
|
566
570
|
@content = @repository.units_for_removal(params[:ids], content_type)
|
567
571
|
else
|
568
572
|
@content = @repository.units_for_removal(params[:ids])
|
569
573
|
end
|
570
574
|
|
571
|
-
|
575
|
+
if @repository.generic?
|
576
|
+
if content_type
|
577
|
+
RepositoryTypeManager.check_content_matches_repo_type!(@repository, @content.first.content_type)
|
578
|
+
else
|
579
|
+
RepositoryTypeManager.check_content_matches_repo_type!(@repository, @repository.repository_type.default_managed_content_type.label)
|
580
|
+
end
|
581
|
+
else
|
582
|
+
RepositoryTypeManager.check_content_matches_repo_type!(@repository, @content.first.class::CONTENT_TYPE)
|
583
|
+
end
|
572
584
|
end
|
573
585
|
|
574
586
|
def filter_by_content_view(query, content_view_id, environment_id, is_available_for)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Katello
|
2
2
|
module ContentViewHelper
|
3
|
-
def separated_repo_mapping(repo_mapping)
|
4
|
-
separated_mapping = { :
|
3
|
+
def separated_repo_mapping(repo_mapping, use_multicopy_actions)
|
4
|
+
separated_mapping = { :pulp3_yum_multicopy => {}, :other => {} }
|
5
5
|
repo_mapping.each do |source_repos, dest_repo|
|
6
|
-
if dest_repo.content_type == "yum" && SmartProxy.pulp_primary.pulp3_support?(dest_repo)
|
7
|
-
separated_mapping[:
|
6
|
+
if dest_repo.content_type == "yum" && SmartProxy.pulp_primary.pulp3_support?(dest_repo) && use_multicopy_actions
|
7
|
+
separated_mapping[:pulp3_yum_multicopy][source_repos] = dest_repo
|
8
8
|
else
|
9
9
|
separated_mapping[:other][source_repos] = dest_repo
|
10
10
|
end
|
@@ -58,19 +58,19 @@ module Katello
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def fetch_lifecycle_environment(host, options = {})
|
61
|
-
return host.lifecycle_environment if host.
|
61
|
+
return host.lifecycle_environment if host.try(:lifecycle_environment_id)
|
62
62
|
selected_host_group = options.fetch(:selected_host_group, nil)
|
63
63
|
return selected_host_group.lifecycle_environment if selected_host_group.present?
|
64
64
|
end
|
65
65
|
|
66
66
|
def fetch_content_view(host, options = {})
|
67
|
-
return host.content_view if host.
|
67
|
+
return host.content_view if host.try(:content_view_id)
|
68
68
|
selected_host_group = options.fetch(:selected_host_group, nil)
|
69
69
|
return selected_host_group.content_view if selected_host_group.present?
|
70
70
|
end
|
71
71
|
|
72
72
|
def fetch_content_source(host, options = {})
|
73
|
-
return host.content_source if host.
|
73
|
+
return host.content_source if host.try(:content_source_id)
|
74
74
|
selected_host_group = options.fetch(:selected_host_group, nil)
|
75
75
|
return selected_host_group.content_source if selected_host_group.present?
|
76
76
|
end
|
@@ -216,11 +216,15 @@ module Katello
|
|
216
216
|
new_host.operatingsystem.kickstart_repos(new_host).map { |repo| OpenStruct.new(repo) }
|
217
217
|
else
|
218
218
|
# case 2
|
219
|
-
os_updated_kickstart_options
|
219
|
+
os_updated_kickstart_options
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
def
|
223
|
+
def fetch_inherited_param(id, entity, parent_value)
|
224
|
+
id.blank? ? parent_value : entity.find(id)
|
225
|
+
end
|
226
|
+
|
227
|
+
def os_updated_kickstart_options(host = nil)
|
224
228
|
# this method gets called in 1 place Once you chose a diff os/content source/arch/lifecycle env/cv
|
225
229
|
# via the os_selected method.
|
226
230
|
# In this case we want it play by the rules of "one of these params" and
|
@@ -228,19 +232,22 @@ module Katello
|
|
228
232
|
os_selection_params = ["operatingsystem_id", 'content_view_id', 'lifecycle_environment_id',
|
229
233
|
'content_source_id', 'architecture_id']
|
230
234
|
view_options = []
|
235
|
+
|
231
236
|
host_params = params[:hostgroup] || params[:host]
|
232
|
-
|
237
|
+
parent = ::Hostgroup.find(host_params[:parent_id]) unless host_params.blank? || host_params[:parent_id].blank?
|
238
|
+
if host_params && (parent || os_selection_params.all? { |key| host_params[key].present? })
|
233
239
|
if host.nil?
|
234
240
|
host = ::Host.new
|
235
241
|
end
|
236
|
-
host.operatingsystem =
|
237
|
-
host.architecture =
|
242
|
+
host.operatingsystem = fetch_inherited_param(host_params[:operatingsystem_id], ::Operatingsystem, parent&.os)
|
243
|
+
host.architecture = fetch_inherited_param(host_params[:architecture_id], ::Architecture, parent&.architecture)
|
244
|
+
lifecycle_env = fetch_inherited_param(host_params[:lifecycle_environment_id], ::Katello::KTEnvironment, parent&.lifecycle_environment)
|
245
|
+
content_view = fetch_inherited_param(host_params[:content_view_id], ::Katello::ContentView, parent&.content_view)
|
246
|
+
content_source = fetch_inherited_param(host_params[:content_source_id], ::SmartProxy, parent&.content_source)
|
238
247
|
|
239
|
-
lifecycle_env = Katello::KTEnvironment.find(host_params[:lifecycle_environment_id])
|
240
|
-
content_view = Katello::ContentView.find(host_params[:content_view_id])
|
241
248
|
host.content_facet = Host::ContentFacet.new(:lifecycle_environment_id => lifecycle_env.id,
|
242
249
|
:content_view_id => content_view.id,
|
243
|
-
:content_source =>
|
250
|
+
:content_source => content_source)
|
244
251
|
if host.operatingsystem.is_a?(Redhat)
|
245
252
|
view_options = host.operatingsystem.kickstart_repos(host).map { |repo| OpenStruct.new(repo) }
|
246
253
|
end
|
@@ -6,7 +6,7 @@ module Actions
|
|
6
6
|
skip_candlepin = options.fetch(:skip_candlepin, false)
|
7
7
|
action_subject(activation_key)
|
8
8
|
|
9
|
-
plan_action(Candlepin::ActivationKey::Destroy, cp_id: activation_key.cp_id)
|
9
|
+
plan_action(Candlepin::ActivationKey::Destroy, cp_id: activation_key.cp_id) if !skip_candlepin && activation_key.cp_id.present?
|
10
10
|
plan_self
|
11
11
|
end
|
12
12
|
|
@@ -4,6 +4,7 @@ module Actions
|
|
4
4
|
class SyncCapsule < ::Actions::EntryAction
|
5
5
|
include Actions::Katello::PulpSelector
|
6
6
|
def plan(smart_proxy, options = {})
|
7
|
+
plan_self(:smart_proxy_id => smart_proxy.id, :options => options)
|
7
8
|
action_subject(smart_proxy)
|
8
9
|
environment = options[:environment]
|
9
10
|
content_view = options[:content_view]
|
@@ -11,6 +12,7 @@ module Actions
|
|
11
12
|
skip_metadata_check = options.fetch(:skip_metadata_check, false)
|
12
13
|
sequence do
|
13
14
|
repos = repos_to_sync(smart_proxy, environment, content_view, repository, skip_metadata_check)
|
15
|
+
return nil if repos.empty?
|
14
16
|
|
15
17
|
repos.in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repo_batch|
|
16
18
|
concurrence do
|
@@ -36,53 +38,6 @@ module Actions
|
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
39
|
-
sync_container_gateway(smart_proxy)
|
40
|
-
end
|
41
|
-
|
42
|
-
def sync_container_gateway(smart_proxy)
|
43
|
-
if smart_proxy.has_feature?(::SmartProxy::CONTAINER_GATEWAY_FEATURE)
|
44
|
-
update_container_repo_list(smart_proxy)
|
45
|
-
users = smart_proxy.container_gateway_users
|
46
|
-
update_user_container_repo_mapping(smart_proxy, users) if users.any?
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def unauthenticated_container_repositories
|
51
|
-
::Katello::Repository.joins(:environment).where("#{::Katello::KTEnvironment.table_name}.registry_unauthenticated_pull" => true).select(:id).pluck(:id)
|
52
|
-
end
|
53
|
-
|
54
|
-
def update_container_repo_list(smart_proxy)
|
55
|
-
# [{ repository: "repoA", auth_required: false }]
|
56
|
-
repo_list = []
|
57
|
-
::Katello::SmartProxyHelper.new(smart_proxy).combined_repos_available_to_capsule.each do |repo|
|
58
|
-
if repo.docker? && !repo.container_repository_name.nil?
|
59
|
-
repo_list << { repository: repo.container_repository_name,
|
60
|
-
auth_required: !unauthenticated_container_repositories.include?(repo.id) }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
smart_proxy.update_container_repo_list(repo_list)
|
64
|
-
end
|
65
|
-
|
66
|
-
def update_user_container_repo_mapping(smart_proxy, users)
|
67
|
-
# Example user-repo mapping:
|
68
|
-
# { users:
|
69
|
-
# [
|
70
|
-
# 'user a' => [{ repository: 'repo 1', auth_required: true }]
|
71
|
-
# ]
|
72
|
-
# }
|
73
|
-
|
74
|
-
user_repo_map = { users: [] }
|
75
|
-
users.each do |user|
|
76
|
-
inner_repo_list = []
|
77
|
-
repositories = ::Katello::Repository.readable_docker_catalog_as(user)
|
78
|
-
repositories.each do |repo|
|
79
|
-
next if repo.container_repository_name.nil?
|
80
|
-
inner_repo_list << { repository: repo.container_repository_name,
|
81
|
-
auth_required: !unauthenticated_container_repositories.include?(repo.id) }
|
82
|
-
end
|
83
|
-
user_repo_map[:users] << { user.login => inner_repo_list }
|
84
|
-
end
|
85
|
-
smart_proxy.update_user_container_repo_mapping(user_repo_map)
|
86
41
|
end
|
87
42
|
|
88
43
|
def repos_to_sync(smart_proxy, environment, content_view, repository, skip_metatadata_check = false)
|
@@ -108,6 +63,11 @@ module Actions
|
|
108
63
|
:link
|
109
64
|
end
|
110
65
|
|
66
|
+
def run
|
67
|
+
smart_proxy = ::SmartProxy.find(input[:smart_proxy_id])
|
68
|
+
smart_proxy.sync_container_gateway
|
69
|
+
end
|
70
|
+
|
111
71
|
def rescue_strategy
|
112
72
|
Dynflow::Action::Rescue::Skip
|
113
73
|
end
|
@@ -4,7 +4,8 @@ module Actions
|
|
4
4
|
class IncrementalUpdates < Actions::EntryAction
|
5
5
|
include Helpers::Presenter
|
6
6
|
|
7
|
-
def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description
|
7
|
+
def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description,
|
8
|
+
use_remote_execution = false)
|
8
9
|
old_new_version_map = {}
|
9
10
|
output_for_version_ids = []
|
10
11
|
|
@@ -28,12 +29,13 @@ module Actions
|
|
28
29
|
handle_composites(old_new_version_map, composite_version_environments, output_for_version_ids, description)
|
29
30
|
end
|
30
31
|
|
31
|
-
if hosts.any? && !content[:errata_ids].blank?
|
32
|
+
if hosts.any? && !content[:errata_ids].blank? && !use_remote_execution
|
32
33
|
errata = ::Katello::Erratum.with_identifiers(content[:errata_ids])
|
33
34
|
hosts = hosts.where(:id => ::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id))
|
34
35
|
plan_action(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, hosts, :errata_ids => content[:errata_ids])
|
35
36
|
end
|
36
|
-
plan_self(:version_outputs => output_for_version_ids)
|
37
|
+
plan_self(:version_outputs => output_for_version_ids, :host_ids => hosts.pluck(:id),
|
38
|
+
:errata_ids => content[:errata_ids], :use_remote_execution => use_remote_execution)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
@@ -59,6 +61,14 @@ module Actions
|
|
59
61
|
end
|
60
62
|
|
61
63
|
def run
|
64
|
+
if input[:errata_ids].present? && input[:host_ids].present? && input[:use_remote_execution]
|
65
|
+
errata_ids = input[:errata_ids].join(',')
|
66
|
+
errata = ::Katello::Erratum.with_identifiers(input[:errata_ids])
|
67
|
+
hosts = ::Host.where(:id => input[:host_ids] &
|
68
|
+
::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id))
|
69
|
+
JobInvocationComposer.for_feature('katello_errata_install', hosts, { :errata => errata_ids }).trigger
|
70
|
+
end
|
71
|
+
|
62
72
|
output[:changed_content] = input[:version_outputs].map do |version_output|
|
63
73
|
{
|
64
74
|
:content_view_version => {:id => version_output[:version_id]},
|
@@ -45,17 +45,12 @@ module Actions
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def finalize
|
48
|
-
|
49
|
-
::Katello::
|
50
|
-
:lifecycle_environment_id => input[:environment_id]).each do |facet|
|
51
|
-
facet.update_applicability_counts
|
52
|
-
facet.update_errata_status
|
53
|
-
end
|
48
|
+
environment = ::Katello::KTEnvironment.find(input[:environment_id])
|
49
|
+
::Katello::ContentView.find(input[:content_view_id]).update_host_statuses(environment)
|
54
50
|
|
55
51
|
history = ::Katello::ContentViewHistory.find(input[:history_id])
|
56
52
|
history.status = ::Katello::ContentViewHistory::SUCCESSFUL
|
57
53
|
history.save!
|
58
|
-
environment = ::Katello::KTEnvironment.find(input[:environment_id])
|
59
54
|
|
60
55
|
if !input[:incremental_update] && sync_proxies?(environment)
|
61
56
|
ForemanTasks.async_task(ContentView::CapsuleSync,
|
@@ -49,13 +49,12 @@ module Actions
|
|
49
49
|
plan_action(ContentView::AddToEnvironment, version, library) unless options[:skip_promotion]
|
50
50
|
repository_mapping = plan_action(ContentViewVersion::CreateRepos, version, source_repositories).repository_mapping
|
51
51
|
# Split Pulp 3 Yum repos out of the repository_mapping. Only Pulp 3 RPM plugin has multi repo copy support.
|
52
|
-
separated_repo_map = separated_repo_mapping(repository_mapping)
|
52
|
+
separated_repo_map = separated_repo_mapping(repository_mapping, content_view.solve_dependencies)
|
53
53
|
|
54
54
|
if options[:importing]
|
55
55
|
handle_import(version, options.slice(:path, :metadata))
|
56
|
-
elsif separated_repo_map[:
|
57
|
-
|
58
|
-
plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum], version)
|
56
|
+
elsif separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present?
|
57
|
+
plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum_multicopy], version)
|
59
58
|
end
|
60
59
|
|
61
60
|
concurrence do
|
@@ -194,12 +193,14 @@ module Actions
|
|
194
193
|
def handle_import(version, path:, metadata:)
|
195
194
|
sequence do
|
196
195
|
plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::Import, version, path: path, metadata: metadata)
|
197
|
-
plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::CopyVersionUnitsToLibrary, version)
|
198
196
|
concurrence do
|
199
197
|
version.importable_repositories.pluck(:id).each do |id|
|
200
|
-
|
198
|
+
# need to force full_indexing for these version repositories
|
199
|
+
# on import. This will then help us correctly copy version units to the library
|
200
|
+
plan_action(Katello::Repository::IndexContent, id: id, full_index: true)
|
201
201
|
end
|
202
202
|
end
|
203
|
+
plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::CopyVersionUnitsToLibrary, version)
|
203
204
|
end
|
204
205
|
end
|
205
206
|
|
@@ -55,7 +55,7 @@ module Actions
|
|
55
55
|
|
56
56
|
sequence do
|
57
57
|
repository_mapping = plan_action(ContentViewVersion::CreateRepos, new_content_view_version, repos_to_clone).repository_mapping
|
58
|
-
separated_repo_map = separated_repo_mapping(repository_mapping)
|
58
|
+
separated_repo_map = separated_repo_mapping(repository_mapping, true)
|
59
59
|
|
60
60
|
repos_to_clone.each do |source_repos|
|
61
61
|
plan_action(Repository::CloneToVersion,
|
@@ -66,8 +66,8 @@ module Actions
|
|
66
66
|
end
|
67
67
|
|
68
68
|
concurrence do
|
69
|
-
if separated_repo_map[:
|
70
|
-
extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:
|
69
|
+
if separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present?
|
70
|
+
extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:pulp3_yum_multicopy], old_version)
|
71
71
|
unit_map = pulp3_content_mapping(content)
|
72
72
|
|
73
73
|
unless extended_repo_mapping.empty? || unit_map.values.flatten.empty?
|
@@ -75,7 +75,7 @@ module Actions
|
|
75
75
|
copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map,
|
76
76
|
dependency_solving: dep_solve).output
|
77
77
|
repos_to_clone.each do |source_repos|
|
78
|
-
if separated_repo_map[:
|
78
|
+
if separated_repo_map[:pulp3_yum_multicopy].keys.include?(source_repos)
|
79
79
|
copy_repos(repository_mapping[source_repos])
|
80
80
|
end
|
81
81
|
end
|
@@ -16,6 +16,7 @@ module Actions
|
|
16
16
|
repositories.each do |repository|
|
17
17
|
sequence do
|
18
18
|
repository.set_container_repository_name
|
19
|
+
repository.clear_smart_proxy_sync_histories
|
19
20
|
plan_action(::Actions::Katello::Repository::InstanceUpdate, repository)
|
20
21
|
plan_action(::Actions::Katello::Repository::CapsuleSync, repository)
|
21
22
|
end
|
@@ -13,6 +13,7 @@ module Actions
|
|
13
13
|
# rubocop:disable Metrics/MethodLength
|
14
14
|
# rubocop:disable Metrics/CyclomaticComplexity
|
15
15
|
# rubocop:disable Metrics/PerceivedComplexity
|
16
|
+
# rubocop:disable Metrics/AbcSize
|
16
17
|
def run
|
17
18
|
repo = ::Katello::Repository.find(input[:id])
|
18
19
|
if repo.docker?
|
@@ -21,6 +22,10 @@ module Actions
|
|
21
22
|
::Katello::DockerManifestList.import_for_repository(repo)
|
22
23
|
elsif repo.file?
|
23
24
|
::Katello::FileUnit.import_for_repository(repo)
|
25
|
+
elsif repo.generic?
|
26
|
+
repo.repository_type.content_types_to_index.each do |type|
|
27
|
+
type.model_class.import_for_repository(repo, generic_content_type: type.content_type)
|
28
|
+
end
|
24
29
|
elsif repo.deb?
|
25
30
|
if input[:import_upload_task] && input[:import_upload_task][:content_unit_href]
|
26
31
|
unit_ids = [input[:import_upload_task][:content_unit_href]]
|
@@ -16,7 +16,11 @@ module Actions
|
|
16
16
|
generate_applicability = options.fetch(:generate_applicability, repository.yum?)
|
17
17
|
|
18
18
|
options[:content_type] ||= ::Katello::RepositoryTypeManager.find(repository.content_type).default_managed_content_type.label
|
19
|
-
|
19
|
+
if ::Katello::RepositoryTypeManager.generic_content_type?(options[:content_type])
|
20
|
+
unit_type_id = options[:content_type]
|
21
|
+
else
|
22
|
+
unit_type_id = SmartProxy.pulp_primary.content_service(options[:content_type])::CONTENT_TYPE
|
23
|
+
end
|
20
24
|
|
21
25
|
sequence do
|
22
26
|
upload_results = concurrence do
|
@@ -10,12 +10,13 @@ module Actions
|
|
10
10
|
param :contents_changed
|
11
11
|
param :matching_content
|
12
12
|
param :source_repository_id
|
13
|
+
param :full_index
|
13
14
|
end
|
14
15
|
|
15
16
|
def run
|
16
17
|
source_repository = ::Katello::Repository.find(input[:source_repository_id]) if input[:source_repository_id]
|
17
18
|
repo = ::Katello::Repository.find(input[:id])
|
18
|
-
repo.index_content(source_repository: source_repository)
|
19
|
+
repo.index_content(source_repository: source_repository, full_index: input[:full_index].present?)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -7,7 +7,7 @@ module Actions
|
|
7
7
|
def plan(repository)
|
8
8
|
action_subject repository
|
9
9
|
repository.save!
|
10
|
-
plan_action(::Actions::Pulp3::Orchestration::Repository::RefreshIfNeeded, repository)
|
10
|
+
plan_action(::Actions::Pulp3::Orchestration::Repository::RefreshIfNeeded, repository, SmartProxy.pulp_primary)
|
11
11
|
plan_self(:repository_id => repository.id)
|
12
12
|
end
|
13
13
|
|
@@ -9,7 +9,7 @@ module Actions
|
|
9
9
|
sequence do
|
10
10
|
plan_action(::Actions::Katello::Repository::MultiCloneContents, extended_repo_map,
|
11
11
|
copy_contents: true,
|
12
|
-
solve_dependencies:
|
12
|
+
solve_dependencies: true,
|
13
13
|
metadata_generate: !incremental)
|
14
14
|
end
|
15
15
|
end
|
@@ -16,7 +16,11 @@ module Actions
|
|
16
16
|
action_subject(repository)
|
17
17
|
|
18
18
|
content_unit_ids = content_units.map(&:id)
|
19
|
-
|
19
|
+
if repository.generic?
|
20
|
+
content_unit_type = options[:content_type] || content_units.first.content_type
|
21
|
+
else
|
22
|
+
content_unit_type = options[:content_type] || content_units.first.class::CONTENT_TYPE
|
23
|
+
end
|
20
24
|
::Katello::RepositoryTypeManager.check_content_matches_repo_type!(repository, content_unit_type)
|
21
25
|
|
22
26
|
generate_applicability = options.fetch(:generate_applicability, repository.yum?)
|
@@ -15,7 +15,12 @@ module Actions
|
|
15
15
|
content_type ||= ::Katello::RepositoryTypeManager.find(repository.content_type).default_managed_content_type.label
|
16
16
|
::Katello::RepositoryTypeManager.check_content_matches_repo_type!(repository, content_type)
|
17
17
|
|
18
|
-
|
18
|
+
if ::Katello::RepositoryTypeManager.generic_content_type?(content_type)
|
19
|
+
unit_type_id = content_type
|
20
|
+
else
|
21
|
+
unit_type_id = SmartProxy.pulp_primary.content_service(content_type)::CONTENT_TYPE
|
22
|
+
end
|
23
|
+
|
19
24
|
upload_actions = []
|
20
25
|
|
21
26
|
generate_applicability = options.fetch(:generate_applicability, repository.yum?)
|
@@ -20,10 +20,16 @@ module Actions
|
|
20
20
|
_("checking Pulp task status")
|
21
21
|
end
|
22
22
|
when :suspended
|
23
|
-
|
24
|
-
|
23
|
+
started_task = combined_tasks.find { |task| task&.started? && !task&.done? }&.pulp_data
|
24
|
+
if started_task
|
25
|
+
name = started_task[:name] || started_task[:description]
|
26
|
+
label = get_task_label(name, started_task[:pulp_href])
|
27
|
+
_("waiting for Pulp to finish the task %s" % label)
|
25
28
|
else
|
26
|
-
|
29
|
+
pending_task = combined_tasks.find { |task| !task&.started? }&.pulp_data
|
30
|
+
name = pending_task[:name] || pending_task[:description]
|
31
|
+
label = get_task_label(name, pending_task[:pulp_href])
|
32
|
+
_("waiting for Pulp to start the task %s" % label) if pending_task
|
27
33
|
end
|
28
34
|
else
|
29
35
|
super
|
@@ -133,6 +139,13 @@ module Actions
|
|
133
139
|
check_for_errors
|
134
140
|
pulp_tasks
|
135
141
|
end
|
142
|
+
|
143
|
+
def get_task_label(name, href)
|
144
|
+
name = name.split('.').last if name
|
145
|
+
href = href.split('-').last[0...-1] if href
|
146
|
+
label = "%s (ID: %s)" % [name, href]
|
147
|
+
label
|
148
|
+
end
|
136
149
|
end
|
137
150
|
end
|
138
151
|
end
|
@@ -15,7 +15,7 @@ module Actions
|
|
15
15
|
if filter_ids.present? || rpm_filenames.present?
|
16
16
|
copy_action = plan_action(Actions::Pulp3::Repository::CopyContent, source_repositories.first, smart_proxy, target_repo,
|
17
17
|
filter_ids: filter_ids, solve_dependencies: solve_dependencies,
|
18
|
-
rpm_filenames: rpm_filenames)
|
18
|
+
rpm_filenames: rpm_filenames, remove_all: true)
|
19
19
|
plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: copy_action.output[:pulp_tasks])
|
20
20
|
else
|
21
21
|
#if we are not filtering, copy the version to the cv repository, and the units for each additional repo
|
@@ -26,7 +26,7 @@ module Actions
|
|
26
26
|
source_repositories[1..-1].each do |source_repo|
|
27
27
|
copy_actions << plan_action(Actions::Pulp3::Repository::CopyContent, source_repo, smart_proxy, target_repo,
|
28
28
|
filter_ids: filter_ids, solve_dependencies: solve_dependencies,
|
29
|
-
rpm_filenames: rpm_filenames)
|
29
|
+
rpm_filenames: rpm_filenames, remove_all: false)
|
30
30
|
end
|
31
31
|
plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: copy_actions.last.output[:pulp_tasks])
|
32
32
|
end
|
@@ -11,11 +11,9 @@ module Actions
|
|
11
11
|
docker_tag = (args.dig(:unit_type_id) == "docker_tag")
|
12
12
|
sequence do
|
13
13
|
if content_unit_href
|
14
|
-
|
15
|
-
duplicate_sha_path_content_list = content_backend_service.content_api.list(
|
16
|
-
"sha256": file[:sha256],
|
17
|
-
"relative_path": file[:filename])
|
14
|
+
duplicate_sha_path_content_list = ::Katello::Pulp3::PulpContentUnit.find_duplicate_unit(repository, args.dig(:unit_type_id), file, file[:sha256])
|
18
15
|
duplicate_content_href = duplicate_sha_path_content_list&.results&.first&.pulp_href
|
16
|
+
|
19
17
|
if duplicate_content_href
|
20
18
|
plan_self(:commit_output => [], :content_unit_href => duplicate_content_href)
|
21
19
|
action_output = plan_action(Pulp3::Repository::ImportUpload, duplicate_content_href, repository, smart_proxy).output
|