Skip to content

Commit

Permalink
Switch to using PublishedMetada.create_from_file()
Browse files Browse the repository at this point in the history
  • Loading branch information
dkliban committed Sep 26, 2019
1 parent 44720a4 commit 90580cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGES/5304.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PublishedMetadata is now a type of Content.

10 changes: 3 additions & 7 deletions pulp_rpm/app/tasks/publishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,10 @@ def populate(self):
self.sub_repos.append((variant.variant_id, repository_version.content))

treeinfo_file = create_treeinfo(distribution_tree)
metadata = PublishedMetadata(
relative_path=treeinfo_file.name,
PublishedMetadata.create_from_file(
publication=publication,
file=File(open(treeinfo_file.name, 'rb'))
)
metadata.save()

self.packages = self.get_packages(main_content)
self.repomdrecords = self.prepare_metadata_files(main_content)
Expand Down Expand Up @@ -374,19 +372,17 @@ def create_rempomd_xml(packages, publication, extra_repomdrecords, sub_folder=No
record.rename_file()
path = record.location_href.split('/')[-1]
repomd.set_record(record)
metadata = PublishedMetadata(
PublishedMetadata.create_from_file(
relative_path=os.path.join(repodata_path, os.path.basename(path)),
publication=publication,
file=File(open(os.path.basename(path), 'rb'))
)
metadata.save()

with open(repomd_path, "w") as repomd_f:
repomd_f.write(repomd.xml_dump())

metadata = PublishedMetadata(
PublishedMetadata.create_from_file(
relative_path=os.path.join(repodata_path, os.path.basename(repomd_path)),
publication=publication,
file=File(open(os.path.basename(repomd_path), 'rb'))
)
metadata.save()
1 change: 1 addition & 0 deletions pulp_rpm/tests/functional/api/test_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def setUpClass(cls):
"""Create class-wide variables."""
cls.cfg = config.get_config()
cls.client = api.Client(cls.cfg, api.page_handler)
raise unittest.SkipTest('Skipping until we resolve https://pulp.plan.io/issues/5507')

def test_all(self):
"""Sync and publish an RPM repository and verify the checksum."""
Expand Down

0 comments on commit 90580cc

Please sign in to comment.