Sha256: e518cca3c298494812316c80b5700992d5b65df44b93d2a636b97e5f5d137c2a
Contents?: true
Size: 1.09 KB
Versions: 30
Compression:
Stored size: 1.09 KB
Contents
module Katello module Pulp class YumMetadataFile < PulpContentUnit CONTENT_TYPE = "yum_repo_metadata_file".freeze def update_model(model) shared_attributes = backend_data.keys & model.class.column_names shared_json = backend_data.select { |key, _v| shared_attributes.include?(key) } repo = ::Katello::Repository.find_by(:pulp_id => backend_data['repo_id']).try(:id) model.update_attributes!(shared_json.merge(repository_id: repo, name: find_name_from_json(backend_data))) end def find_name_from_json(json) # get the name of the metadata file. # Notice that pulp does not have a way to get name of the metadata file # so we infer it from the _storage_path # for example from the following storage path # "/var/lib/pulp/content/units/yum_repo_metadata_file/..../050-productid.gz" # we find the right most '/' and return everything after that # i.e -> "050-productid.gz" File.basename(json["_storage_path"]) end end end end
Version data entries
30 entries across 30 versions & 1 rubygems