Skip to content

Commit

Permalink
Problem: RSyncFastForwardUnitPublishStep publishes incorrectly
Browse files Browse the repository at this point in the history
Solution: Enable RSyncFastForwardUnitPublishStep to publish the same type of units into different
directories by extracting the publish path of a unit from it's symlink location.

This problem was introduced when the yum distributor was modified to publish repositories with a
new layout. This patch makes the RPM rsync distributor consistent with the yum distributor.

re pulp#1976
https://pulp.plan.io/issues/1976
  • Loading branch information
dkliban committed Jan 15, 2017
1 parent 486da83 commit 418687a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions server/pulp/plugins/util/publish_step.py
Expand Up @@ -1307,11 +1307,17 @@ def process_main(self, item=None):
storage_dir = os.path.join(pulp_config.get('server', 'storage_dir'), 'content', 'units')
relative_content_unit_path = os.path.relpath(item.storage_path, storage_dir)
self.parent.content_unit_file_list.append(relative_content_unit_path)
filename = item.get_symlink_name()
if self.published_unit_path:
filename = item.get_symlink_name()
published_unit_path = self.published_unit_path
else:
filename = os.path.split(item.get_symlink_name())[1]
published_unit_path = os.path.split(item.get_symlink_name())[0].split('/')

symlink = self.make_link_unit(item, filename, self.get_working_dir(),
self.remote_repo_path,
self.get_config().get("remote")["root"],
self.published_unit_path)
published_unit_path)
self.parent.symlink_list.append(symlink)

def make_link_unit(self, unit, filename, working_dir, remote_repo_path, remote_root,
Expand Down Expand Up @@ -1353,7 +1359,9 @@ def make_link_unit(self, unit, filename, working_dir, remote_repo_path, remote_r
if os.path.islink(dest):
os.remove(dest)
os.symlink(link_source, dest)
return os.path.join(*(published_unit_path + [filename]))
if self.published_unit_path:
return os.path.join(*(published_unit_path + [filename]))
return unit.get_symlink_name()

def get_origin_rel_path(self, unit):
"""
Expand Down

0 comments on commit 418687a

Please sign in to comment.