-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #29421 - add pulp3 debian support
create, update, sync and delete debian repositories on pulp3 Add tests Add signing-service Add verification of deb-repos in pulp3
- Loading branch information
1 parent
152529f
commit cbd77ad
Showing
41 changed files
with
13,586 additions
and
17,065 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
require "pulpcore_client" | ||
|
||
module Katello | ||
module Pulp3 | ||
module Api | ||
class Apt < Core | ||
def self.api_exception_class | ||
PulpDebClient::ApiError | ||
end | ||
|
||
def self.client_module | ||
PulpDebClient | ||
end | ||
|
||
def self.remote_class | ||
PulpDebClient::DebAptRemote | ||
end | ||
|
||
def self.distribution_class | ||
PulpDebClient::DebAptDistribution | ||
end | ||
|
||
def self.publication_class | ||
PulpDebClient::DebAptPublication | ||
end | ||
|
||
def self.repository_sync_url_class | ||
PulpDebClient::RepositorySyncURL | ||
end | ||
|
||
def api_client | ||
PulpDebClient::ApiClient.new(smart_proxy.pulp3_configuration(PulpDebClient::Configuration)) | ||
end | ||
|
||
def repositories_api | ||
PulpDebClient::RepositoriesAptApi.new(api_client) | ||
end | ||
|
||
def repository_versions_api | ||
PulpDebClient::RepositoriesDebVersionsApi.new(api_client) | ||
end | ||
|
||
def remotes_api | ||
PulpDebClient::RemotesAptApi.new(api_client) | ||
end | ||
|
||
def publications_api | ||
PulpDebClient::PublicationsAptApi.new(api_client) | ||
end | ||
|
||
def distributions_api | ||
PulpDebClient::DistributionsAptApi.new(api_client) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Katello | ||
module Pulp3 | ||
class Deb < PulpContentUnit | ||
include LazyAccessor | ||
CONTENT_TYPE = "deb".freeze | ||
|
||
def self.content_api | ||
PulpDebClient::ContentPackagesApi.new(Katello::Pulp3::Api::Apt.new(SmartProxy.pulp_primary!).api_client) | ||
end | ||
|
||
def self.content_api_create(opts = {}) | ||
self.content_api.create(opts) | ||
end | ||
|
||
def self.create_content(options) | ||
fail _("Artifact Id and relative path are needed to create content") unless options.dig(:file_name) && options.dig(:artifact) | ||
PulpDebClient::DebContent.new(relative_path: options[:file_name], artifact: options[:artifact]) | ||
end | ||
|
||
def self.ids_for_repository(repo_id) | ||
repo = Katello::Pulp3::Repository::Apt.new(Katello::Repository.find(repo_id), SmartProxy.pulp_primary) | ||
repo_content_list = repo.content_list | ||
repo_content_list.map { |content| content.try(:pulp_href) } | ||
end | ||
|
||
def update_model(model) | ||
custom_json = {} | ||
custom_json['checksum'] = backend_data['sha256'] | ||
custom_json['filename'] = backend_data['relative_path'] | ||
custom_json['name'] = backend_data['package'] | ||
custom_json['version'] = backend_data['version'] | ||
custom_json['description'] = backend_data['description'] | ||
custom_json['architecture'] = backend_data['architecture'] | ||
model.update!(custom_json) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require 'pulp_deb_client' | ||
|
||
module Katello | ||
module Pulp3 | ||
class Repository | ||
class Apt < ::Katello::Pulp3::Repository | ||
SIGNING_SERVICE_NAME = 'katello_deb_sign'.freeze | ||
|
||
def remote_options | ||
deb_remote_options = { | ||
distributions: root.deb_releases | ||
} | ||
deb_remote_options[:components] = root.deb_components.present? ? root.deb_components : nil | ||
deb_remote_options[:architectures] = root.deb_architectures.present? ? root.deb_architectures : nil | ||
|
||
if root.url.blank? | ||
deb_remote_options[:url] = nil | ||
end | ||
|
||
deb_remote_options[:gpgkey] = root.gpg_key.present? ? root.gpg_key.content : nil | ||
|
||
common_remote_options.merge(deb_remote_options) | ||
end | ||
|
||
def publication_options(repository_version) | ||
ss = api.signing_services_api.list(name: SIGNING_SERVICE_NAME).results | ||
popts = super(repository_version) | ||
popts.merge!( | ||
{ | ||
# structured is not necessary for subscription-manager | ||
#structured: true, # publish real suites (e.g. 'stable') | ||
simple: true # publish all into 'default'-suite | ||
} | ||
) | ||
popts[:signing_service] = ss[0].pulp_href if ss && ss.length == 1 | ||
popts | ||
end | ||
|
||
def distribution_options(path) | ||
{ | ||
base_path: path, | ||
publication: repo.publication_href, | ||
name: "#{generate_backend_object_name}" | ||
} | ||
end | ||
|
||
def partial_repo_path | ||
"/pulp/deb/#{repo.relative_path}/".sub('//', '/') | ||
end | ||
|
||
def copy_content_for_source | ||
# TODO | ||
fail NotImplementedError | ||
end | ||
|
||
def regenerate_applicability | ||
# TODO | ||
fail NotImplementedError | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
Katello::RepositoryTypeManager.register(::Katello::Repository::DEB_TYPE) do | ||
service_class Katello::Pulp::Repository::Deb | ||
pulp3_service_class Katello::Pulp3::Repository::Apt | ||
pulp3_api_class Katello::Pulp3::Api::Apt | ||
pulp3_plugin 'pulp_deb' | ||
prevent_unneeded_metadata_publish | ||
|
||
default_managed_content_type Katello::Deb | ||
content_type Katello::Deb, :pulp2_service_class => ::Katello::Pulp::Deb, :removable => true, :uploadable => true | ||
content_type Katello::Deb, | ||
:pulp2_service_class => ::Katello::Pulp::Deb, | ||
:pulp3_service_class => ::Katello::Pulp3::Deb, | ||
:removable => true, | ||
:uploadable => true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.