katello 4.3.0.rc2 → 4.3.0
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/controllers/katello/api/v2/capsule_content_controller.rb +11 -3
- data/app/controllers/katello/api/v2/content_uploads_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/generic_content_units_controller.rb +10 -4
- data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +8 -0
- data/app/controllers/katello/api/v2/repositories_controller.rb +57 -10
- data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +1 -9
- data/app/graphql/types/host_collection.rb +18 -0
- data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
- data/app/lib/actions/katello/repository/import_upload.rb +12 -2
- data/app/lib/actions/pulp3/abstract_async_task.rb +1 -1
- data/app/lib/actions/pulp3/capsule_content/generate_metadata.rb +5 -4
- data/app/lib/actions/pulp3/capsule_content/reclaim_space.rb +25 -0
- data/app/lib/actions/pulp3/orchestration/repository/import_repository_upload.rb +36 -0
- data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +1 -1
- data/app/lib/actions/pulp3/repository/commit_upload.rb +3 -1
- data/app/lib/actions/pulp3/repository/import_upload.rb +4 -2
- data/app/lib/actions/pulp3/repository/reclaim_space.rb +25 -0
- data/app/lib/actions/pulp3/repository/save_artifact.rb +12 -8
- data/app/lib/katello/resources/registry.rb +1 -1
- data/app/models/katello/candlepin/repository_mapper.rb +1 -1
- data/app/models/katello/concerns/host_managed_extensions.rb +1 -1
- data/app/models/katello/concerns/smart_proxy_extensions.rb +16 -8
- data/app/models/katello/glue/provider.rb +1 -1
- data/app/models/katello/glue/pulp/repos.rb +2 -0
- data/app/models/katello/pulp3/repository_reference.rb +7 -0
- data/app/models/katello/repository.rb +5 -5
- data/app/models/katello/root_repository.rb +27 -2
- data/app/models/setting/content.rb +2 -8
- data/app/services/katello/component_view_presenter.rb +1 -1
- data/app/services/katello/organization_creator.rb +11 -4
- data/app/services/katello/pulp3/api/core.rb +16 -2
- data/app/services/katello/pulp3/content.rb +4 -2
- data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +1 -1
- data/app/services/katello/pulp3/pulp_content_unit.rb +9 -3
- data/app/services/katello/pulp3/repository/yum.rb +2 -0
- data/app/services/katello/pulp3/repository.rb +11 -6
- data/app/services/katello/pulp3/repository_mirror.rb +2 -1
- data/app/services/katello/registration_manager.rb +1 -1
- data/app/services/katello/repository_type.rb +2 -1
- data/app/views/foreman/job_templates/change_content_source.erb +42 -0
- data/app/views/foreman/smart_proxies/_content_sync.html.erb +10 -4
- data/app/views/foreman/smart_proxies/_reclaim_space.html.erb +12 -0
- data/app/views/foreman/smart_proxies/show.html.erb +4 -2
- data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +2 -0
- data/app/views/katello/api/v2/repositories/base.json.rabl +1 -0
- data/app/views/katello/api/v2/repositories/show.json.rabl +1 -1
- data/config/routes/api/v2.rb +5 -0
- data/db/migrate/20210331180353_katello_pool_organization_id_not_nullable.rb +2 -0
- data/db/migrate/20211129200124_remove_dependency_solving_algorithm_setting.rb +5 -0
- data/db/migrate/20211202172358_add_repository_mirroring_policy.rb +26 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +3 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +21 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.factory.js +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/sync-state.service.js +2 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-repositories.controller.js +14 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +5 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-reclaim-space-modal.controller.js +36 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +16 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details-reclaim-space-modal.html +18 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +13 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +19 -9
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/mirroring-policy.service.js +30 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +9 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +13 -8
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/product-repositories-reclaim-space-modal.controller.js +35 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository.factory.js +3 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories-reclaim-space-modal.html +18 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +7 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/pulp-primary/pulp-primary.controller.js +35 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/pulp-primary/pulp-primary.factory.js +18 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/pulp-primary/pulp-primary.module.js +14 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/pulp-primary/pulp-primary.routes.js +16 -0
- data/lib/katello/permission_creator.rb +3 -3
- data/lib/katello/plugin.rb +7 -0
- data/lib/katello/repository_types/ostree.rb +3 -1
- data/lib/katello/tasks/upgrades/4.3/fix_url_auth.rake +25 -0
- data/lib/katello/version.rb +1 -1
- data/package.json +1 -0
- data/webpack/components/AddedStatusLabel.js +2 -1
- data/webpack/components/Content/Details/ContentDetails.js +1 -1
- data/webpack/components/Content/Details/__tests__/__snapshots__/ContentDetails.test.js.snap +1 -1
- data/webpack/components/EditableTextInput/EditableTextInput.js +76 -17
- data/webpack/components/EditableTextInput/__tests__/editableTextInput.test.js +82 -0
- data/webpack/components/EditableTextInput/editableTextInput.scss +4 -0
- data/webpack/components/Errata/index.js +58 -0
- data/webpack/components/RoutedTabs/index.js +5 -2
- data/webpack/components/Table/EmptyStateMessage.js +4 -2
- data/webpack/components/Table/TableWrapper.js +11 -5
- data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard.js +24 -30
- data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +109 -0
- data/webpack/components/extensions/HostDetails/Cards/__tests__/errataOverviewCard.test.js +56 -0
- data/webpack/components/extensions/HostDetails/Tabs/ContentTab/index.js +1 -0
- data/webpack/components/extensions/HostDetails/Tabs/ErrataTab.js +57 -55
- data/webpack/components/extensions/HostDetails/Tabs/ErrataTab.scss +2 -7
- data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.js +38 -38
- data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.scss +3 -7
- data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +39 -39
- data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.scss +3 -3
- data/webpack/components/extensions/HostDetails/Tabs/TracesTab.js +58 -56
- data/webpack/components/extensions/HostDetails/Tabs/TracesTab.scss +4 -5
- data/webpack/containers/Application/config.js +1 -1
- data/webpack/containers/Application/overrides.scss +56 -7
- data/webpack/global_index.js +13 -5
- data/webpack/scenes/Content/ContentPage.js +4 -4
- data/webpack/scenes/Content/Details/ContentDetails.js +22 -20
- data/webpack/scenes/Content/Details/ContentInfo.js +1 -1
- data/webpack/scenes/Content/Details/__tests__/contentDetail.test.js +2 -0
- data/webpack/scenes/ContentViews/ContentViewsConstants.js +3 -3
- data/webpack/scenes/ContentViews/ContentViewsPage.js +17 -13
- data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +8 -12
- data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +1 -1
- data/webpack/scenes/ContentViews/Copy/__tests__/copyContentView.test.js +1 -1
- data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +1 -1
- data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionFinish.js +10 -4
- data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +5 -2
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +22 -11
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewBulkAddModal.js +31 -18
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +36 -31
- data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +8 -8
- data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +118 -58
- data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +1 -1
- data/webpack/scenes/ContentViews/Details/DetailsContainer.js +5 -3
- data/webpack/scenes/ContentViews/Details/Filters/Add/CVFilterAddModal.js +5 -2
- data/webpack/scenes/ContentViews/Details/Filters/AffectedRepositories/AffectedRepositoryTable.js +1 -4
- data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +8 -8
- data/webpack/scenes/ContentViews/Details/Filters/CVErrataDateFilterContent.js +15 -9
- data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +20 -16
- data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +7 -10
- data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +42 -45
- data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +5 -5
- data/webpack/scenes/ContentViews/Details/Filters/ContentType.js +4 -4
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +9 -11
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +6 -1
- data/webpack/scenes/ContentViews/Details/Filters/Rules/ContainerTag/AddEditContainerTagRuleModal.js +1 -1
- data/webpack/scenes/ContentViews/Details/Filters/Rules/Package/AddEditPackageRuleModal.js +16 -22
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +7 -7
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/ContentViewPackageGroupFilter.test.js +3 -5
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +2 -1
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataDateFilterContent.test.js +1 -9
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +2 -4
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +2 -4
- data/webpack/scenes/ContentViews/Details/Promote/ContentViewVersionPromote.js +20 -7
- data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +4 -0
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +4 -7
- data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +11 -3
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +2 -0
- data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionContent.js +44 -41
- data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionErrata.js +4 -4
- data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +31 -5
- data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveCVVersionWizard.js +4 -1
- data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVVersionDeleteFinish.js +14 -3
- data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +3 -3
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetails.js +4 -2
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetails.scss +5 -2
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsHeader.js +135 -32
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +21 -1
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetailsEmpty.test.js +22 -1
- data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +2 -1
- data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +4 -4
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +1 -1
- data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +1 -1
- data/webpack/scenes/ContentViews/components/CVBreadCrumb.js +1 -1
- data/webpack/scenes/ContentViews/components/ContentViewIcon.js +6 -2
- data/webpack/scenes/ContentViews/components/ContentViewsCounter.js +1 -1
- data/webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js +8 -8
- data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationForm.js +185 -0
- data/webpack/scenes/Subscriptions/Manifest/CdnConfigurationForm.scss +3 -0
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +95 -266
- data/webpack/scenes/Subscriptions/Manifest/__tests__/CdnConfigurationForm.test.js +114 -0
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +0 -29
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +1 -0
- data/webpack/scenes/Tasks/TaskActions.js +4 -3
- data/webpack/scenes/Tasks/__tests__/__snapshots__/TaskActions.test.js.snap +1 -0
- data/webpack/utils/helpers.js +1 -1
- metadata +27 -5
- data/webpack/utils/dateTimeHelpers.js +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bebacc5b4b127cfadaeb424ce9f04aa6e2ba132a0d8d959d8456bd393418abf
|
4
|
+
data.tar.gz: 473b94c0aec5d6b73a174f334edf1f9079d42c53d16ef0ab60cc939af0e0e4b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 000e85ae93b95be282c88d10eec6f364526cfdb9e377de7b56d82a8df882e8390c40690b4d7b0740c24196fa10d20d166b48779f3422699e7a970bfb1722cdc2
|
7
|
+
data.tar.gz: 23a1e59f555ddbe334a98d6937aa64de3d46b1bc6b8fb33a61166e317792686fae9f30af480d0037226eebf6d341769a15acd1972d7bb05d20696ab6af1fb9dc
|
@@ -4,7 +4,7 @@ module Katello
|
|
4
4
|
api_base_url "/katello/api"
|
5
5
|
end
|
6
6
|
|
7
|
-
before_action :find_capsule, :except => [:sync, :cancel_sync, :add_lifecycle_environment, :remove_lifecycle_environment]
|
7
|
+
before_action :find_capsule, :except => [:sync, :cancel_sync, :add_lifecycle_environment, :remove_lifecycle_environment, :reclaim_space]
|
8
8
|
before_action :find_editable_capsule, :only => [:sync, :cancel_sync, :add_lifecycle_environment, :remove_lifecycle_environment]
|
9
9
|
before_action :find_environment, :only => [:add_lifecycle_environment, :remove_lifecycle_environment]
|
10
10
|
before_action :find_optional_organization, :only => [:sync_status]
|
@@ -86,6 +86,14 @@ module Katello
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
api :POST, '/capsules/:id/reclaim_space', N_('Reclaim space from all On Demand repositories on a smart proxy')
|
90
|
+
param :id, :number, :required => true, :desc => N_('Id of the smart proxy')
|
91
|
+
def reclaim_space
|
92
|
+
find_capsule(true)
|
93
|
+
task = async_task(::Actions::Pulp3::CapsuleContent::ReclaimSpace, @capsule)
|
94
|
+
respond_for_async :resource => task
|
95
|
+
end
|
96
|
+
|
89
97
|
protected
|
90
98
|
|
91
99
|
def respond_for_lifecycle_environments_index(environments)
|
@@ -104,9 +112,9 @@ module Katello
|
|
104
112
|
end
|
105
113
|
end
|
106
114
|
|
107
|
-
def find_capsule
|
115
|
+
def find_capsule(primary_okay = false)
|
108
116
|
@capsule = SmartProxy.unscoped.authorized(:view_capsule_content).find(params[:id])
|
109
|
-
unless @capsule&.pulp_mirror?
|
117
|
+
unless @capsule&.pulp_mirror? || primary_okay
|
110
118
|
fail _("This request may only be performed on a Smart proxy that has the Pulpcore feature with mirror=true.")
|
111
119
|
end
|
112
120
|
end
|
@@ -10,7 +10,7 @@ module Katello
|
|
10
10
|
param :repository_id, :number, :required => true, :desc => N_("repository id")
|
11
11
|
param :size, :number, :required => true, :desc => N_("Size of file to upload")
|
12
12
|
param :checksum, String, :required => false, :desc => N_("Checksum of file to upload")
|
13
|
-
param :content_type, RepositoryTypeManager.uploadable_content_types(false).map(&:label), :required => false, :desc => N_("content type ('deb', 'docker_manifest', 'file', '
|
13
|
+
param :content_type, RepositoryTypeManager.uploadable_content_types(false).map(&:label), :required => false, :desc => N_("content type ('deb', 'docker_manifest', 'file', 'ostree_ref', 'rpm', 'srpm')")
|
14
14
|
def create
|
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
|
@@ -76,7 +76,7 @@ module Katello
|
|
76
76
|
|
77
77
|
api :PUT, "/content_view_versions/:id/republish_repositories", N_("Forces a republish of the version's repositories' metadata")
|
78
78
|
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
79
|
-
param :force, :bool, :desc => N_("Force metadata regeneration to proceed. Dangerous when repositories use
|
79
|
+
param :force, :bool, :desc => N_("Force metadata regeneration to proceed. Dangerous when repositories use the 'Complete Mirroring' mirroring policy"), :required => true
|
80
80
|
def republish_repositories
|
81
81
|
unless ::Foreman::Cast.to_bool(params[:force])
|
82
82
|
fail HttpErrors::BadRequest, _("Metadata republishing must be forced because it is a dangerous operation.")
|
@@ -1,10 +1,15 @@
|
|
1
1
|
module Katello
|
2
2
|
class Api::V2::GenericContentUnitsController < Api::V2::ApiController
|
3
|
+
resource_description do
|
4
|
+
name 'Content Units'
|
5
|
+
param :content_type, String, desc: N_("Possible values: #{Katello::RepositoryTypeManager.generic_content_types.join(", ")}"), required: true
|
6
|
+
end
|
7
|
+
apipie_concern_subst(:a_resource => N_("a content unit"), :resource_id => "content_units")
|
8
|
+
|
3
9
|
Katello::RepositoryTypeManager.generic_content_types(false).each do |type|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
10
|
+
api :GET, "/#{type.pluralize}", N_("List %s" % type.pluralize)
|
11
|
+
api :GET, "/#{type.pluralize}/:id", N_("Show %s" % type.gsub(/_/, ' '))
|
12
|
+
api :GET, "/repositories/:repository_id/#{type.pluralize}/:id", N_("Show %s" % type.gsub(/_/, ' '))
|
8
13
|
end
|
9
14
|
|
10
15
|
include Katello::Concerns::Api::V2::RepositoryContentController
|
@@ -14,6 +19,7 @@ module Katello
|
|
14
19
|
end
|
15
20
|
|
16
21
|
def resource_class
|
22
|
+
fail "Required param content_type is missing" unless params[:content_type]
|
17
23
|
::Katello::GenericContentUnit.where(content_type: params[:content_type].singularize)
|
18
24
|
end
|
19
25
|
|
@@ -50,6 +50,14 @@ module Katello
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
api :POST, "/repositories/bulk/reclaim_space", N_("Reclaim space from On Demand repositories")
|
54
|
+
param :ids, Array, :desc => N_("List of repository ids"), :required => true
|
55
|
+
def reclaim_space_from_repositories
|
56
|
+
task = async_task(::Actions::Pulp3::Repository::ReclaimSpace, @repositories)
|
57
|
+
|
58
|
+
respond_for_async :resource => task
|
59
|
+
end
|
60
|
+
|
53
61
|
private
|
54
62
|
|
55
63
|
def find_repositories
|
@@ -7,7 +7,7 @@ module Katello
|
|
7
7
|
generic_repo_wrap_params << option.name
|
8
8
|
end
|
9
9
|
|
10
|
-
repo_wrap_params = RootRepository.attribute_names.concat([:ignore_global_proxy]) + generic_repo_wrap_params
|
10
|
+
repo_wrap_params = RootRepository.attribute_names.concat([:ignore_global_proxy, :mirror_on_sync]) + generic_repo_wrap_params
|
11
11
|
|
12
12
|
wrap_parameters :repository, :include => repo_wrap_params
|
13
13
|
|
@@ -23,7 +23,7 @@ module Katello
|
|
23
23
|
before_action :find_unauthorized_katello_resource, :only => [:gpg_key_content]
|
24
24
|
before_action :find_authorized_katello_resource, :only => [:show, :update, :destroy, :sync,
|
25
25
|
:remove_content, :upload_content, :republish,
|
26
|
-
:import_uploads, :verify_checksum]
|
26
|
+
:import_uploads, :verify_checksum, :reclaim_space]
|
27
27
|
before_action :find_content, :only => :remove_content
|
28
28
|
before_action :find_organization_from_repo, :only => [:update]
|
29
29
|
before_action :error_on_rh_product, :only => [:create]
|
@@ -53,7 +53,8 @@ module Katello
|
|
53
53
|
param :docker_tags_whitelist, Array, :desc => N_("Comma-separated list of tags to sync for Container Image repository")
|
54
54
|
param :download_policy, ["immediate", "on_demand"], :desc => N_("download policy for yum repos (either 'immediate' or 'on_demand')")
|
55
55
|
param :download_concurrency, :number, :desc => N_("Used to determine download concurrency of the repository in pulp3. Use value less than 20. Defaults to 10")
|
56
|
-
param :mirror_on_sync, :bool, :desc => N_("true if this repository when synced has to be mirrored from the source and stale rpms removed")
|
56
|
+
param :mirror_on_sync, :bool, :desc => N_("true if this repository when synced has to be mirrored from the source and stale rpms removed (Deprecated)")
|
57
|
+
param :mirroring_policy, Katello::RootRepository::MIRRORING_POLICIES, :desc => N_("Policy to set for mirroring content. Must be one of %s.") % RootRepository::MIRRORING_POLICIES
|
57
58
|
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")
|
58
59
|
param :upstream_username, String, :desc => N_("Username of the upstream repository user used for authentication")
|
59
60
|
param :upstream_password, String, :desc => N_("Password of the upstream repository user used for authentication")
|
@@ -234,6 +235,10 @@ module Katello
|
|
234
235
|
fail HttpErrors::UnprocessableEntity, msg
|
235
236
|
end
|
236
237
|
|
238
|
+
if !repo_params[:url].nil? && URI(repo_params[:url]).userinfo
|
239
|
+
fail "Do not include the username/password in the URL. Use the username/password settings instead."
|
240
|
+
end
|
241
|
+
|
237
242
|
gpg_key = get_content_credential(repo_params, CONTENT_CREDENTIAL_GPG_KEY_TYPE)
|
238
243
|
ssl_ca_cert = get_content_credential(repo_params, CONTENT_CREDENTIAL_SSL_CA_CERT_TYPE)
|
239
244
|
ssl_client_cert = get_content_credential(repo_params, CONTENT_CREDENTIAL_SSL_CLIENT_CERT_TYPE)
|
@@ -264,7 +269,7 @@ module Katello
|
|
264
269
|
|
265
270
|
api :PUT, "/repositories/:id/republish", N_("Forces a republish of the specified repository, regenerating metadata and symlinks on the filesystem.")
|
266
271
|
param :id, :number, :desc => N_("Repository identifier"), :required => true
|
267
|
-
param :force, :bool, :desc => N_("Force metadata regeneration to proceed. Dangerous when repositories use
|
272
|
+
param :force, :bool, :desc => N_("Force metadata regeneration to proceed. Dangerous when repositories use the 'Complete Mirroring' mirroring policy."), :required => true
|
268
273
|
def republish
|
269
274
|
unless ::Foreman::Cast.to_bool(params[:force])
|
270
275
|
fail HttpErrors::BadRequest, _('Metadata republishing must be forced because it is a dangerous operation.')
|
@@ -317,6 +322,15 @@ module Katello
|
|
317
322
|
raise HttpErrors::BadRequest, e.message
|
318
323
|
end
|
319
324
|
|
325
|
+
api :POST, "/repositories/:id/reclaim_space", N_("Reclaim space from an On Demand repository")
|
326
|
+
param :id, :number, :required => true, :desc => N_("repository ID")
|
327
|
+
def reclaim_space
|
328
|
+
task = async_task(::Actions::Pulp3::Repository::ReclaimSpace, @repository)
|
329
|
+
respond_for_async :resource => task
|
330
|
+
rescue Errors::InvalidActionOptionError => e
|
331
|
+
raise HttpErrors::BadRequest, e.message
|
332
|
+
end
|
333
|
+
|
320
334
|
api :PUT, "/repositories/:id", N_("Update a repository")
|
321
335
|
param :id, :number, :required => true, :desc => N_("repository ID")
|
322
336
|
param :name, String, :required => false
|
@@ -324,6 +338,9 @@ module Katello
|
|
324
338
|
param_group :repo
|
325
339
|
def update
|
326
340
|
repo_params = repository_params
|
341
|
+
if !repo_params[:url].nil? && URI(repo_params[:url]).userinfo
|
342
|
+
fail "Do not include the username/password in the URL. Use the username/password settings instead."
|
343
|
+
end
|
327
344
|
|
328
345
|
if @repository.generic?
|
329
346
|
generic_remote_options = generic_remote_options_hash(repo_params)
|
@@ -421,10 +438,16 @@ module Katello
|
|
421
438
|
end
|
422
439
|
|
423
440
|
begin
|
441
|
+
upload_args = {
|
442
|
+
content_type: params[:content_type],
|
443
|
+
generate_metadata: generate_metadata,
|
444
|
+
sync_capsule: sync_capsule
|
445
|
+
}
|
446
|
+
upload_args.merge!(generic_content_type_import_upload_args)
|
447
|
+
|
424
448
|
respond_for_async(resource: send(
|
425
449
|
async ? :async_task : :sync_task,
|
426
|
-
::Actions::Katello::Repository::ImportUpload, @repository, uploads,
|
427
|
-
generate_metadata: generate_metadata, sync_capsule: sync_capsule, content_type: params[:content_type]))
|
450
|
+
::Actions::Katello::Repository::ImportUpload, @repository, uploads, upload_args))
|
428
451
|
rescue => e
|
429
452
|
raise HttpErrors::BadRequest, e.message
|
430
453
|
end
|
@@ -479,7 +502,7 @@ module Katello
|
|
479
502
|
|
480
503
|
# rubocop:disable Metrics/CyclomaticComplexity
|
481
504
|
def repository_params
|
482
|
-
keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password,
|
505
|
+
keys = [:download_policy, :mirror_on_sync, :mirroring_policy, :sync_policy, :arch, :verify_ssl_on_sync, :upstream_password,
|
483
506
|
:upstream_username, :download_concurrency, :upstream_authentication_token,
|
484
507
|
{:os_versions => []}, :deb_releases, :deb_components, :deb_architectures, :description,
|
485
508
|
:http_proxy_policy, :http_proxy_id, :retain_package_versions_count, {:ignorable_content => []}
|
@@ -503,7 +526,8 @@ module Katello
|
|
503
526
|
keys += [:url, :gpg_key_id, :ssl_ca_cert_id, :ssl_client_cert_id, :ssl_client_key_id, :unprotected, :name,
|
504
527
|
:checksum_type]
|
505
528
|
end
|
506
|
-
params.require(:repository).permit(*keys).to_h.with_indifferent_access
|
529
|
+
to_return = params.require(:repository).permit(*keys).to_h.with_indifferent_access
|
530
|
+
handle_mirror_on_sync(to_return)
|
507
531
|
end
|
508
532
|
|
509
533
|
def get_content_credential(repo_params, content_type)
|
@@ -523,8 +547,8 @@ module Katello
|
|
523
547
|
:checksum_type, :download_policy, :http_proxy_policy).to_h.with_indifferent_access)
|
524
548
|
root.docker_upstream_name = repo_params[:docker_upstream_name] if repo_params[:docker_upstream_name]
|
525
549
|
root.docker_tags_whitelist = repo_params.fetch(:docker_tags_whitelist, []) if root.docker?
|
526
|
-
root.mirror_on_sync = ::Foreman::Cast.to_bool(repo_params[:mirror_on_sync]) if repo_params.key?(:mirror_on_sync)
|
527
550
|
root.verify_ssl_on_sync = ::Foreman::Cast.to_bool(repo_params[:verify_ssl_on_sync]) if repo_params.key?(:verify_ssl_on_sync)
|
551
|
+
root.mirroring_policy = repo_params[:mirroring_policy] || Katello::RootRepository::MIRRORING_POLICY_CONTENT
|
528
552
|
root.upstream_username = repo_params[:upstream_username] if repo_params.key?(:upstream_username)
|
529
553
|
root.upstream_password = repo_params[:upstream_password] if repo_params.key?(:upstream_password)
|
530
554
|
root.upstream_authentication_token = repo_params[:upstream_authentication_token] if repo_params.key?(:upstream_authentication_token)
|
@@ -555,6 +579,19 @@ module Katello
|
|
555
579
|
end
|
556
580
|
# rubocop:enable Metrics/CyclomaticComplexity
|
557
581
|
|
582
|
+
def handle_mirror_on_sync(repo_params)
|
583
|
+
if !repo_params.key?(:mirroring_policy) && repo_params.key?(:mirror_on_sync)
|
584
|
+
::Foreman::Deprecation.api_deprecation_warning("mirror_on_sync is deprecated in favor of mirroring_policy. It will be removed in Katello 4.6.")
|
585
|
+
if ::Foreman::Cast.to_bool(repo_params[:mirror_on_sync])
|
586
|
+
repo_params[:mirroring_policy] = Katello::RootRepository::MIRRORING_POLICY_CONTENT
|
587
|
+
else
|
588
|
+
repo_params[:mirroring_policy] = Katello::RootRepository::MIRRORING_POLICY_ADDITIVE
|
589
|
+
end
|
590
|
+
end
|
591
|
+
repo_params.delete(:mirror_on_sync)
|
592
|
+
repo_params
|
593
|
+
end
|
594
|
+
|
558
595
|
def error_on_rh_product
|
559
596
|
fail HttpErrors::BadRequest, _("Red Hat products cannot be manipulated.") if @product.redhat?
|
560
597
|
end
|
@@ -617,10 +654,20 @@ module Katello
|
|
617
654
|
generic_remote_options
|
618
655
|
end
|
619
656
|
|
657
|
+
def generic_content_type_import_upload_args
|
658
|
+
args = {}
|
659
|
+
@repository.repository_type&.import_attributes&.collect do |import_attribute|
|
660
|
+
if params[import_attribute.api_param]
|
661
|
+
args[import_attribute.api_param] = params[import_attribute.api_param]
|
662
|
+
end
|
663
|
+
end
|
664
|
+
args
|
665
|
+
end
|
666
|
+
|
620
667
|
def check_import_parameters
|
621
668
|
@repository.repository_type&.import_attributes&.each do |import_attribute|
|
622
669
|
if import_attribute.required && params[import_attribute.api_param].blank?
|
623
|
-
fail HttpErrors::UnprocessableEntity, _(
|
670
|
+
fail HttpErrors::UnprocessableEntity, _('%s is required') % import_attribute.api_param
|
624
671
|
end
|
625
672
|
end
|
626
673
|
end
|
@@ -28,7 +28,7 @@ module Katello
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def context_urls
|
31
|
-
super.merge(rhsm_url: rhsm_url, pulp_content_url: pulp_content_url)
|
31
|
+
super.merge(rhsm_url: smart_proxy.rhsm_url, pulp_content_url: smart_proxy.pulp_content_url)
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
@@ -43,14 +43,6 @@ module Katello
|
|
43
43
|
proxy
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
47
|
-
def rhsm_url
|
48
|
-
URI(smart_proxy.rhsm_url)
|
49
|
-
end
|
50
|
-
|
51
|
-
def pulp_content_url
|
52
|
-
smart_proxy.setting(SmartProxy::PULP3_FEATURE, 'content_app_url')
|
53
|
-
end
|
54
46
|
end
|
55
47
|
end
|
56
48
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Types
|
2
|
+
class HostCollection < BaseObject
|
3
|
+
description "A collection of hosts"
|
4
|
+
model_class ::Katello::HostCollection
|
5
|
+
|
6
|
+
global_id_field :id
|
7
|
+
timestamps
|
8
|
+
field :name, String
|
9
|
+
field :description, String
|
10
|
+
field :max_hosts, Integer
|
11
|
+
field :unlimited_hosts, Boolean
|
12
|
+
has_many :hosts, Types::Host
|
13
|
+
|
14
|
+
def self.graphql_definition
|
15
|
+
super.tap { |type| type.instance_variable_set(:@name, 'Katello::HostCollection') }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -40,7 +40,7 @@ module Actions
|
|
40
40
|
pulp_repo = repo.backend_service(smart_proxy)
|
41
41
|
if !current_repos_on_capsule_ids.include?(repo.id)
|
42
42
|
pulp_repo.create_mirror_entities
|
43
|
-
|
43
|
+
else
|
44
44
|
tasks += pulp_repo.refresh_mirror_entities
|
45
45
|
end
|
46
46
|
end
|
@@ -4,6 +4,7 @@ module Actions
|
|
4
4
|
module Repository
|
5
5
|
class ImportUpload < Actions::EntryAction
|
6
6
|
include Actions::Katello::PulpSelector
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
7
8
|
def plan(repository, uploads, options = {})
|
8
9
|
action_subject(repository)
|
9
10
|
repository.clear_smart_proxy_sync_histories
|
@@ -21,6 +22,7 @@ module Actions
|
|
21
22
|
else
|
22
23
|
unit_type_id = SmartProxy.pulp_primary.content_service(options[:content_type])::CONTENT_TYPE
|
23
24
|
end
|
25
|
+
content_type = ::Katello::RepositoryTypeManager.find_content_type(options[:content_type])
|
24
26
|
|
25
27
|
sequence do
|
26
28
|
upload_results = concurrence do
|
@@ -34,8 +36,15 @@ module Actions
|
|
34
36
|
unit_metadata: unit_metadata
|
35
37
|
}
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
+
import_upload_args.merge!(options)
|
40
|
+
|
41
|
+
if content_type.repository_import_on_upload
|
42
|
+
action_class = ::Actions::Pulp3::Orchestration::Repository::ImportRepositoryUpload
|
43
|
+
else
|
44
|
+
action_class = ::Actions::Pulp3::Orchestration::Repository::ImportUpload
|
45
|
+
end
|
46
|
+
|
47
|
+
import_upload = plan_action(action_class, repository, SmartProxy.pulp_primary, import_upload_args)
|
39
48
|
plan_action(FinishUpload, repository, :import_upload_task => import_upload.output,
|
40
49
|
generate_metadata: false, content_type: options[:content_type])
|
41
50
|
import_upload.output
|
@@ -46,6 +55,7 @@ module Actions
|
|
46
55
|
plan_self(repository_id: repository.id, sync_capsule: sync_capsule, upload_results: upload_results)
|
47
56
|
end
|
48
57
|
end
|
58
|
+
# rubocop:enable Metrics/MethodLength
|
49
59
|
|
50
60
|
def run
|
51
61
|
repository = ::Katello::Repository.find(input[:repository_id])
|
@@ -113,7 +113,7 @@ module Actions
|
|
113
113
|
def overwrite_pulp_error(message)
|
114
114
|
case message
|
115
115
|
when 'This repository uses features which are incompatible with \'mirror\' sync. Please sync without mirroring enabled.'
|
116
|
-
'
|
116
|
+
'The "Complete Mirroring" mirroring policy is not compatible with this repository. You may want to update it to use "Content Only"'
|
117
117
|
else
|
118
118
|
message
|
119
119
|
end
|
@@ -17,13 +17,14 @@ module Actions
|
|
17
17
|
|
18
18
|
def invoke_external_task
|
19
19
|
repository = ::Katello::Repository.find(input[:repository_id])
|
20
|
+
backend = repository.backend_service(smart_proxy).with_mirror_adapter
|
20
21
|
#yum repositories use metadata mirroring always, so we should never
|
21
|
-
# regenerate metadata on proxies
|
22
|
-
|
22
|
+
# regenerate metadata on proxies. but if there is no publication,
|
23
|
+
# it means the repo was likely empty and syncing didn't generate one
|
24
|
+
if repository.yum? && backend.publication_href.present?
|
23
25
|
[]
|
24
26
|
else
|
25
|
-
|
26
|
-
repository.backend_service(smart_proxy).with_mirror_adapter.create_publication
|
27
|
+
backend.create_publication
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module CapsuleContent
|
4
|
+
class ReclaimSpace < Pulp3::AbstractAsyncTask
|
5
|
+
def plan(smart_proxy)
|
6
|
+
if smart_proxy.pulp_primary?
|
7
|
+
repository_hrefs = ::Katello::Pulp3::RepositoryReference.default_cv_repository_hrefs(::Katello::Repository.unscoped.on_demand, ::Organization.all)
|
8
|
+
repository_hrefs.flatten!
|
9
|
+
else
|
10
|
+
if smart_proxy.download_policy != ::Katello::RootRepository::DOWNLOAD_ON_DEMAND
|
11
|
+
fail _('Only On Demand smart proxies may have space reclaimed.')
|
12
|
+
end
|
13
|
+
repository_hrefs = ::Katello::Pulp3::Api::Core.new(smart_proxy).core_repositories_list_all(fields: 'pulp_href').map(&:pulp_href)
|
14
|
+
end
|
15
|
+
plan_self(repository_hrefs: repository_hrefs, smart_proxy_id: smart_proxy.id)
|
16
|
+
end
|
17
|
+
|
18
|
+
def invoke_external_task
|
19
|
+
output[:pulp_tasks] = ::Katello::Pulp3::Api::Core.new(SmartProxy.find(input[:smart_proxy_id])).
|
20
|
+
repositories_reclaim_space_api.reclaim(repo_hrefs: input[:repository_hrefs])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module Orchestration
|
4
|
+
module Repository
|
5
|
+
#Used for a different type of uploading where you are importing an entire repository, not a single content unit
|
6
|
+
# This workflow involves never actually creating a content unit directly, but instead importing the artifact directly into the repository
|
7
|
+
class ImportRepositoryUpload < Pulp3::Abstract
|
8
|
+
def plan(repository, smart_proxy, args)
|
9
|
+
file = {:filename => args.dig(:unit_key, :name), :sha256 => args.dig(:unit_key, :checksum) }
|
10
|
+
sequence do
|
11
|
+
upload_href = "/pulp/api/v3/uploads/#{args.dig(:upload_id)}/" if args.dig(:upload_id) && args.dig(:upload_id) != 'duplicate'
|
12
|
+
commit_output = plan_action(Pulp3::Repository::CommitUpload,
|
13
|
+
repository,
|
14
|
+
smart_proxy,
|
15
|
+
upload_href,
|
16
|
+
args.dig(:unit_key, :checksum)).output
|
17
|
+
|
18
|
+
artifact_output = plan_action(Pulp3::Repository::SaveArtifact,
|
19
|
+
file,
|
20
|
+
repository,
|
21
|
+
smart_proxy,
|
22
|
+
commit_output[:pulp_tasks],
|
23
|
+
args.dig(:unit_type_id), args).output
|
24
|
+
plan_self(:artifact_output => artifact_output)
|
25
|
+
plan_action(Pulp3::Repository::SaveVersion, repository, tasks: artifact_output[:pulp_tasks])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
output[:content_unit_href] = input[:artifact_output][:content_unit_href] || input[:artifact_output][:pulp_tasks].last[:created_resources].first
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Actions
|
2
2
|
module Pulp3
|
3
3
|
module Repository
|
4
|
+
#Creates an artifacts
|
4
5
|
class CommitUpload < Pulp3::AbstractAsyncTask
|
5
6
|
def plan(repository, smart_proxy, upload_href, sha256)
|
6
7
|
plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :upload_href => upload_href, :sha256 => sha256)
|
@@ -10,10 +11,11 @@ module Actions
|
|
10
11
|
repo = ::Katello::Repository.find(input[:repository_id])
|
11
12
|
repo_backend_service = repo.backend_service(smart_proxy)
|
12
13
|
uploads_api = repo_backend_service.core_api.uploads_api
|
14
|
+
|
13
15
|
duplicate_sha_artifact_list = ::Katello::Pulp3::Api::Core.new(smart_proxy).artifacts_api.list("sha256": input[:sha256])
|
14
16
|
duplicate_sha_artifact_href = duplicate_sha_artifact_list&.results&.first&.pulp_href
|
15
17
|
if duplicate_sha_artifact_href
|
16
|
-
uploads_api.delete(input[:upload_href])
|
18
|
+
uploads_api.delete(input[:upload_href]) if input[:upload_href]
|
17
19
|
output[:artifact_href] = duplicate_sha_artifact_href
|
18
20
|
output[:pulp_tasks] = nil
|
19
21
|
else
|
@@ -4,10 +4,11 @@ module Actions
|
|
4
4
|
module Pulp3
|
5
5
|
module Repository
|
6
6
|
class ImportUpload < Pulp3::AbstractAsyncTask
|
7
|
-
def plan(save_artifact_output, repository, smart_proxy)
|
7
|
+
def plan(save_artifact_output, repository, smart_proxy, options = {})
|
8
8
|
plan_self(:save_artifact_output => save_artifact_output,
|
9
9
|
:repository_id => repository.id,
|
10
|
-
:smart_proxy_id => smart_proxy.id
|
10
|
+
:smart_proxy_id => smart_proxy.id,
|
11
|
+
:options => options)
|
11
12
|
end
|
12
13
|
|
13
14
|
def invoke_external_task
|
@@ -19,6 +20,7 @@ module Actions
|
|
19
20
|
|
20
21
|
repo = ::Katello::Repository.find(input[:repository_id])
|
21
22
|
repo_backend_service = repo.backend_service(smart_proxy)
|
23
|
+
|
22
24
|
output[:content_unit_href] = content_unit_href
|
23
25
|
output[:pulp_tasks] = [repo_backend_service.add_content(content_unit_href)]
|
24
26
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp3
|
3
|
+
module Repository
|
4
|
+
class ReclaimSpace < Pulp3::AbstractAsyncTask
|
5
|
+
def plan(repositories, smart_proxy = SmartProxy.pulp_primary)
|
6
|
+
repositories = [repositories] if repositories.is_a?(::Katello::Repository)
|
7
|
+
if repositories.empty?
|
8
|
+
fail _("No repositories selected.")
|
9
|
+
end
|
10
|
+
repositories = repositories.select { |repo| repo.download_policy == ::Katello::RootRepository::DOWNLOAD_ON_DEMAND }
|
11
|
+
if repositories.empty?
|
12
|
+
fail _("Only On Demand repositories may have space reclaimed.")
|
13
|
+
end
|
14
|
+
repository_hrefs = ::Katello::Pulp3::RepositoryReference.default_cv_repository_hrefs(repositories, Organization.current)
|
15
|
+
plan_self(repository_hrefs: repository_hrefs, smart_proxy_id: smart_proxy.id)
|
16
|
+
end
|
17
|
+
|
18
|
+
def invoke_external_task
|
19
|
+
output[:pulp_tasks] = ::Katello::Pulp3::Api::Core.new(SmartProxy.find(input[:smart_proxy_id])).
|
20
|
+
repositories_reclaim_space_api.reclaim(repo_hrefs: input[:repository_hrefs])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -2,6 +2,7 @@ module Actions
|
|
2
2
|
module Pulp3
|
3
3
|
module Repository
|
4
4
|
class SaveArtifact < Pulp3::AbstractAsyncTask
|
5
|
+
#This task creates a content unit and may or may not create a new repository version in the process
|
5
6
|
def plan(file, repository, smart_proxy, tasks, unit_type_id, options = {})
|
6
7
|
options[:file_name] = file[:filename]
|
7
8
|
options[:sha256] = file[:sha256] || Digest::SHA256.hexdigest(File.read(file[:path]))
|
@@ -15,17 +16,20 @@ module Actions
|
|
15
16
|
content_type = input[:unit_type_id]
|
16
17
|
content_backend_service = SmartProxy.pulp_primary.content_service(content_type)
|
17
18
|
|
18
|
-
existing_content = ::Katello::Pulp3::PulpContentUnit.find_duplicate_unit(repository, input[
|
19
|
+
existing_content = ::Katello::Pulp3::PulpContentUnit.find_duplicate_unit(repository, input[:unit_type_id], {filename: input[:options][:file_name]}, input[:options][:sha256])
|
19
20
|
existing_content_href = existing_content&.results&.first&.pulp_href
|
20
21
|
|
21
|
-
if
|
22
|
-
output[:
|
23
|
-
[]
|
22
|
+
if ::Katello::RepositoryTypeManager.find_content_type(input[:unit_type_id]).repository_import_on_upload
|
23
|
+
output[:pulp_tasks] = [repository.backend_service(smart_proxy).repository_import_content(artifact_href, input[:options])]
|
24
24
|
else
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
if existing_content_href
|
26
|
+
output[:content_unit_href] = existing_content_href
|
27
|
+
[]
|
28
|
+
else
|
29
|
+
output[:pulp_tasks] = [content_backend_service.content_api_create(relative_path: input[:options][:file_name],
|
30
|
+
artifact: artifact_href,
|
31
|
+
content_type: content_type)]
|
32
|
+
end
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
@@ -32,7 +32,7 @@ module Katello
|
|
32
32
|
self.prefix = "/pulpcore_registry/"
|
33
33
|
self.site = "#{uri.scheme}://#{uri.host}:#{uri.port}"
|
34
34
|
self.ca_cert_file = Setting[:ssl_ca_file]
|
35
|
-
pulp_primary.pulp3_ssl_configuration(self)
|
35
|
+
pulp_primary.pulp3_ssl_configuration(self, :net_http)
|
36
36
|
|
37
37
|
self
|
38
38
|
end
|
@@ -34,7 +34,7 @@ module Katello
|
|
34
34
|
:content_type => katello_content_type,
|
35
35
|
:unprotected => unprotected?,
|
36
36
|
:download_policy => download_policy,
|
37
|
-
:
|
37
|
+
:mirroring_policy => Katello::RootRepository::MIRRORING_POLICY_COMPLETE
|
38
38
|
)
|
39
39
|
|
40
40
|
Repository.new(:root => root,
|
@@ -109,7 +109,7 @@ module Katello
|
|
109
109
|
self.host_statuses.where(type: ::Katello::HostStatusManager::STATUSES.map(&:name)).each do |status|
|
110
110
|
status.refresh!
|
111
111
|
end
|
112
|
-
refresh_global_status
|
112
|
+
refresh_global_status
|
113
113
|
end
|
114
114
|
|
115
115
|
def queue_refresh_content_host_status
|