Sha256: beb0d99e4376a206a31bef5c6dc9c4eab8666b11caa7b99a08d666f38f85e2d4
Contents?: true
Size: 1.17 KB
Versions: 4
Compression:
Stored size: 1.17 KB
Contents
module Katello module Pulp3 class FileUnit < PulpContentUnit include LazyAccessor CONTENT_TYPE = "file".freeze def self.content_api PulpFileClient::ContentFilesApi.new(Katello::Pulp3::Repository::File.api_client(SmartProxy.pulp_master!)) 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) PulpFileClient::FileContent.new(relative_path: options[:file_name], artifact: options[:artifact]) end def self.ids_for_repository(repo_id) repo = Katello::Pulp3::Repository::File.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master) 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['path'] = backend_data['relative_path'] custom_json['name'] = File.basename(backend_data['relative_path'].try(:split, '/').try(:[], -1)) model.update_attributes!(custom_json) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems