Project

Profile

Help

Issue #2791

Updated by dalley almost 7 years ago

 
 Two specific special cases will cause units to be included in a publish which are not meant to be - units which have not been published via the predistributor. 

 1.      Deleting a unit will cause a full republish of all units, including units which have not yet been published by the yum predistributor 

 <pre> 
 dnf download cowsay 
 phttp POST https://localhost/pulp/api/v2/repositories/zoo/distributors/ < rsync_distributor.json 
 pulp-admin rpm repo sync run --repo-id zoo 
 phttp POST https://localhost/pulp/api/v2/repositories/zoo/actions/publish/ id=yum_distributor 
 phttp POST https://localhost/pulp/api/v2/repositories/zoo/actions/publish/ id=my_rpm_rsync_distributor 
 pulp-admin rpm repo remove rpm --repo-id zoo --str-eq 'filename=kangaroo-0.2-1.noarch.rpm' 
 phttp POST https://localhost/pulp/api/v2/repositories/zoo/actions/publish/ id=yum_distributor 
 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=my_rpm_rsync_distributor 

 </pre> 

 Result: cowsay RPM is published via rsync despite not having been published by the yum predistributor 


 2.      On the very first rsync publish, if a predistributor publish has occurred it will do a full publish of all units, including those not yet published via the yum predistributor 
 <pre> 

 dnf download cowsay 
 phttp POST https://localhost/pulp/api/v2/repositories/zoo/distributors/ < rsync_distributor.json 
 phttp POST https://localhost/pulp/api/v2/repositories/zoo/actions/publish/ id=yum_distributor 
 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=my_rpm_rsync_distributor 
 </pre> 

 Result: cowsay RPM is published via rsync despite not having been published by the yum predistributor 


 The culprit is this code in pulp/server/plugins/rsync/publish.py: 

 <pre> 

 ..... 
 ..... 
 ..... 
         if self.is_fastforward(): 
             start_date = self.last_published 
             end_date = None 
             if self.predistributor: 
                 end_date = self.predistributor["last_publish"] 
             date_filter = self.create_date_range_filter(start_date=start_date, end_date=end_date) 
         else: 
             date_filter = None 
 ..... 
 ..... 
 ..... 


 def is_fastforward(self): 
      .... 
      .... 
      .... 
      return last_published and ((last_deleted and last_published > last_deleted) or not last_deleted) and not force_full and               not delete 
 </pre> 

 If it is the first publish or if a unit has been or is being deleted, is_fastforward() resolves to False, True, and the date filter is set to "None".    Therefore, it is not respecting the date of the predistributor publish.

Back