Class: Katello::Pulp3::ContentViewVersion::SyncableFormatExport
- Defined in:
- app/services/katello/pulp3/content_view_version/syncable_format_export.rb
Constant Summary
Constants inherited from Export
Export::FORMATS, Export::IMPORTABLE, Export::SYNCABLE
Instance Attribute Summary
Attributes inherited from Export
#base_path, #content_view_version, #destination_server, #from_content_view_version, #repository, #smart_proxy
Instance Method Summary collapse
- #create_export(exporter_data, _options = {}) ⇒ Object
- #create_exporter ⇒ Object
- #destroy_exporter(exporter_data) ⇒ Object
- #fetch_export(exporter_href) ⇒ Object
- #generate_repository_exporter_path ⇒ Object
Methods inherited from Export
create, #date_dir, find_generated_export_view, find_library_export_view, find_repository_export_view, #format, #generate_exporter_path, #generate_metadata, generate_product_repo_strings, #incremental?, #initialize, #repositories, #repository_hrefs, #validate!, #version_hrefs
Methods included from ImportExportCommon
#api, #fetch_repository_info, #generate_id, #generate_name, #version_href_to_repository_href, #zero_version_href
Constructor Details
This class inherits a constructor from Katello::Pulp3::ContentViewVersion::Export
Instance Method Details
#create_export(exporter_data, _options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/services/katello/pulp3/content_view_version/syncable_format_export.rb', line 11 def create_export(exporter_data, = {}) = { publication: repository.publication_href } if incremental? from_exporter = Export.new(smart_proxy: smart_proxy, content_view_version: from_content_view_version) from_repo = from_exporter.repositories.find_by(library_instance_id: repository.library_instance) [:start_repository_version] = from_repo.version_href unless from_repo.blank? end [api.yum_export_api.create(exporter_data[:pulp_href], )] end |
#create_exporter ⇒ Object
5 6 7 8 9 |
# File 'app/services/katello/pulp3/content_view_version/syncable_format_export.rb', line 5 def create_exporter api.yum_exporter_api.create(name: "#{generate_id(content_view_version)}-#{repository.id}", path: generate_repository_exporter_path, method: :hardlink) end |
#destroy_exporter(exporter_data) ⇒ Object
25 26 27 28 29 30 |
# File 'app/services/katello/pulp3/content_view_version/syncable_format_export.rb', line 25 def destroy_exporter(exporter_data) exporter_href = exporter_data[:pulp_href] export_data = fetch_export(exporter_href) api.yum_export_api.delete(export_data.pulp_href) api.yum_exporter_api.delete(exporter_href) end |
#fetch_export(exporter_href) ⇒ Object
21 22 23 |
# File 'app/services/katello/pulp3/content_view_version/syncable_format_export.rb', line 21 def fetch_export(exporter_href) api.yum_export_api.list(exporter_href).results.first end |
#generate_repository_exporter_path ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/services/katello/pulp3/content_view_version/syncable_format_export.rb', line 32 def generate_repository_exporter_path if repository.docker? content_path = repository.library_instance_or_self.relative_path else _org, _content, content_path = repository.library_instance_or_self.relative_path.split("/", 3) end content_path = content_path.sub(%r|^/|, '') "#{generate_exporter_path}/#{content_path}".gsub(/\s/, '_') end |