Issue #2743
closedIf unit has never been deleted from a repo, rsync distributor incorrectly forces full publish
Description
In pulp server/pulp/plugins/rsync/publish.py there is the following code which appears to be incorrect:
def is_fastforward(self):
...
if self.last_deleted:
last_deleted = self.last_deleted.replace(tzinfo=None)
else:
last_published = None
...
return last_published and ((last_deleted and last_published > last_deleted) or
not last_deleted) and not force_full and\
not delete
If last_deleted is None (a unit has never been deleted from the repo), then last_published is set to None and fast-forward publish doesn't happen. There's no indication of why this should happen and it seems likely to be a mistake. "last_published = None" may have been intended to be "last_deleted = None".
Steps to reproduce in development environment: (see also https://pulp.plan.io/issues/2532 )
# start with clean pulp
pclean ; ppopulate
dnf download cowsay
pulp-admin rpm repo sync run --repo-id zoo
# rsync_distributor.json example:
# {
# "distributor_id": "my_rpm_rsync_distributor",
# "distributor_type_id": "rpm_rsync_distributor",
# "distributor_config": {
# "remote": {
# "auth_type": "publickey",
# "ssh_user": "vagrant",
# "ssh_identity_file": "/usr/share/httpd/.ssh/id_rsa",
# "host": "localhost",
# "root": "/home/vagrant/pulp_root"
# },
# "predistributor_id": "yum_distributor"
# }
# }
phttp POST https://localhost/pulp/api/v2/repositories/zoo/distributors/ < rsync_distributor.json
# ensure both distributors are fully published:
phttp POST https://localhost/pulp/api/v2/repositories/zoo/actions/publish/ id=yum_distributor
# and wait until the publish task completes
phttp POST https://localhost/pulp/api/v2/repositories/zoo/actions/publish/ id=my_rpm_rsync_distributor
# and wait until the publish task completes
pulp-admin rpm repo uploads rpm --repo-id zoo --file cowsay-3.04-4.fc25.noarch.rpm
phttp POST https://localhost/pulp/api/v2/repositories/zoo/actions/publish/ id=yum_distributor
# and wait until publish completes
phttp POST https://localhost/pulp/api/v2/repositories/zoo/actions/publish/ id=my_rpm_rsync_distributor
# expected behavior: fast-forward publish is used
# actual behavior: fast-forward publish is not used since a unit has never been deleted from zoo repo
Note the distributor doesn't make it obvious whether fast-forward publish was used. When reproducing this I added logs to the distributor to determine which code paths were taken.
Related issues
Updated by rmcgover over 7 years ago
- Status changed from NEW to CLOSED - DUPLICATE
This has already been reported a month ago as https://pulp.plan.io/issues/2666 .
Updated by bmbouter over 7 years ago
- Is duplicate of Issue #2666: Rsync publish for RPM repo fails to run in fast forward mode added