Sha256: 4c60229406114b24349091fa7cc7ae1dedabfdd8f6b6226e2a2b0221a280f4f2
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
module Actions module Katello module ContentViewVersion class Import < Actions::EntryAction PULP_USER = 'pulp'.freeze def plan(content_view, path:) content_view.check_ready_to_import! unless SmartProxy.pulp_primary.pulp3_repository_type_support?(::Katello::Repository::YUM_TYPE) fail HttpErrors::BadRequest, _("This API endpoint is only valid for Pulp 3 repositories.") end ::Katello::Pulp3::ContentViewVersion::Import.check_permissions!(path) metadata = ::Katello::Pulp3::ContentViewVersion::Import.metadata(path) major = metadata[:content_view_version][:major] minor = metadata[:content_view_version][:minor] if ::Katello::ContentViewVersion.where(major: major, minor: minor, content_view: content_view).exists? cvv_name = "#{content_view.name} #{major}.#{minor}" fail _("Content View Version specified in the metadata - '%{name}' already exists. "\ "If you wish to replace the existing version, delete %{name} and try again. " % { name: cvv_name }) end plan_action(::Actions::Katello::ContentView::Publish, content_view, '', path: path, import_only: true, major: major, minor: minor) end def humanized_name _("Import Content View Version") end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems