Sha256: 43863826ef1f4f155e91adf4345fcb148559e16a95e5ad6cf7b4ccc5b3ed7662
Contents?: true
Size: 1.91 KB
Versions: 54
Compression:
Stored size: 1.91 KB
Contents
module Actions module Pulp3 module Orchestration module Repository class UploadContent < Pulp3::Abstract include Actions::Helpers::OutputPropagator def plan(repository, smart_proxy, file, unit_type_id) sequence do checksum = Digest::SHA256.hexdigest(File.read(file[:path])) duplicate_sha_path_content_list = ::Katello::Pulp3::PulpContentUnit.find_duplicate_unit(repository, unit_type_id, file, checksum) duplicate_content_href = duplicate_sha_path_content_list&.results&.first&.pulp_href unless duplicate_content_href duplicate_sha_artifact_list = ::Katello::Pulp3::Api::Core.new(smart_proxy).artifacts_api.list("sha256": Digest::SHA256.hexdigest(File.read(file[:path]))) duplicate_sha_artifact_href = duplicate_sha_artifact_list&.results&.first&.pulp_href if duplicate_sha_artifact_href artifact_action_output = plan_action(Pulp3::Repository::SaveArtifact, file, repository, smart_proxy, nil, unit_type_id, artifact_href: duplicate_sha_artifact_href).output else upload_action_output = plan_action(Pulp3::Repository::UploadFile, repository, smart_proxy, file[:path]).output artifact_action_output = plan_action(Pulp3::Repository::SaveArtifact, file, repository, smart_proxy, upload_action_output[:pulp_tasks], unit_type_id).output end end artifact_action_output ||= {:content_unit_href => duplicate_content_href} action_output = plan_action(Pulp3::Repository::ImportUpload, artifact_action_output, repository, smart_proxy).output plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output plan_self(:subaction_output => action_output) end end end end end end end
Version data entries
54 entries across 54 versions & 1 rubygems