Skip to content

Commit

Permalink
Fixing publication for sub repos
Browse files Browse the repository at this point in the history
Publication was raising errors for sub repos, because it couldn't find
the file due to wrong path
https://pulp.plan.io/issues/5630
closes #5630
  • Loading branch information
fao89 committed Oct 30, 2019
1 parent ca18b58 commit fbd36ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES/5630.bugfix
@@ -0,0 +1 @@
Fix publication for sub repos
10 changes: 7 additions & 3 deletions pulp_rpm/app/tasks/publishing.py
Expand Up @@ -277,7 +277,7 @@ def create_rempomd_xml(packages, publication, extra_repomdrecords, sub_folder=No

if sub_folder:
cwd = os.path.join(cwd, sub_folder)
repodata_path = os.path.join(repodata_path, sub_folder)
repodata_path = os.path.join(sub_folder, repodata_path)

# Prepare metadata files
repomd_path = os.path.join(cwd, "repomd.xml")
Expand Down Expand Up @@ -372,10 +372,14 @@ def create_rempomd_xml(packages, publication, extra_repomdrecords, sub_folder=No
record.rename_file()
path = record.location_href.split('/')[-1]
repomd.set_record(record)

if sub_folder:
path = os.path.join(sub_folder, path)

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'))
file=File(open(path, 'rb'))
)

with open(repomd_path, "w") as repomd_f:
Expand All @@ -384,5 +388,5 @@ def create_rempomd_xml(packages, publication, extra_repomdrecords, sub_folder=No
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'))
file=File(open(repomd_path, 'rb'))
)

0 comments on commit fbd36ad

Please sign in to comment.