Project

Profile

Help

Issue #4219

Updated by daviddavis almost 6 years ago

Syncing a repository that has sha1 in repomd.xml, but sha256 in primary.xml fails using on_demand. 

 Steps to reproduce: 
 1. Find/create a repo with sha1 checksums in repomd.xml, but sha256 in primary.xml 
 2. Create a repo in pulp using on_demand 
 3. Sync and observe the following error: 

 <pre> 
 Traceback (most recent call last):\n" + 
   File \"/usr/lib/python2.7/site-packages/celery/app/trace.py\", line 367, in trace_task\n" + 
     R = retval = fun(*args, **kwargs)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py\", line 529, in __call__\n" + 
     return super(Task, self).__call__(*args, **kwargs)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py\", line 107, in __call__\n" + 
     return super(PulpTask, self).__call__(*args, **kwargs)\n" + 
   File \"/usr/lib/python2.7/site-packages/celery/app/trace.py\", line 622, in __protected_call__\n" + 
     return self.run(*args, **kwargs)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/server/controllers/repository.py\", line 1109, in publish\n" + 
     result = check_publish(repo_obj, dist_id, dist_inst, transfer_repo, conduit, call_config)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/server/controllers/repository.py\", line 1206, in check_publish\n" + 
     result = _do_publish(repo_obj, dist_id, dist_inst, transfer_repo, conduit, call_config)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/server/controllers/repository.py\", line 1258, in _do_publish\n" + 
     publish_report = publish_repo(transfer_repo, conduit, call_config)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py\", line 737, in wrap_f\n" + 
     return f(*args, **kwargs)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp_rpm/plugins/distributors/yum/distributor.py\", line 174, in publish_repo\n" + 
     return self._publisher.process_lifecycle()\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/plugins/util/publish_step.py\", line 572, in process_lifecycle\n" + 
     super(PluginStep, self).process_lifecycle()\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/plugins/util/publish_step.py\", line 163, in process_lifecycle\n" + 
     step.process()\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/plugins/util/publish_step.py\", line 239, in process\n" + 
     self._process_block(item=item)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp/plugins/util/publish_step.py\", line 301, in _process_block\n" + 
     self.process_main(item=item)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp_rpm/plugins/distributors/yum/publish.py\", line 499, in process_main\n" + 
     context.add_unit_metadata(unit)\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp_rpm/plugins/distributors/yum/metadata/filelists.py\", line 42, in add_unit_metadata\n" + 
     self.metadata_file_handle.write(unit.render_filelists(self.checksum_type))\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp_rpm/plugins/db/models.py\", line 868, in render_filelists\n" + 
     context = Context({'pkgid': self.get_or_calculate_and_save_checksum(checksumtype)})\n" + 
   File \"/usr/lib/python2.7/site-packages/pulp_rpm/plugins/db/models.py\", line 258, in get_or_calculate_and_save_checksum\n" + 
     checksumtype=checksumtype)\n" + 
 PulpCodedException: Checksum type \"sha1\" is not available for all units in the repository. Make sure those units have been downloaded.\n", 
 </pre> 

 It looks like Here we compare the unit checksumtype against the publish checksumtype being passed in here: in: 

 https://github.com/pulp/pulp_rpm/blob/2-master/plugins/pulp_rpm/plugins/db/models.py#L254 

 This checksum type comes from the repo scratchpad which is populated here: 

 https://github.com/pulp/pulp_rpm/blob/2-master/plugins/pulp_rpm/plugins/importers/yum/sync.py#L513-L533 

 It’s just grabbing the first item from the first metadata file to determine the repo’s checksum type. In this case, it’s sha1 while the checksum type on the package is sha256. 

Back