Project

Profile

Help

Issue #6630

closed

Missing revision-tag in repomd.xml is causing errors

Added by andreas.dijkman about 4 years ago. Updated almost 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

If a repomd.xml-file is missing the revision-tag, repository can't be synced and throws errors. I think this is introduced in commit https://github.com/pulp/pulp_rpm/commit/444b7acc9eb9db81444ff853cccba50a3834544a, which is related to #6367.

Example of syncing repositories without revision-tag, almost all Oracle Linux yum-repositories. For example: http://yum.oracle.com/repo/OracleLinux/OL8/UEKR6/x86_64/repodata/repomd.xml

The errors I get are

pulp: rq.worker:ERROR: django.db.utils.IntegrityError: null value in column "last_sync_revision_number" violates not-null constraint
DETAIL:  Failing row contains (9f9b589b-beb7-4b6a-ba6d-03eeb26d6d62, f, null, null, 0, null, {"other": "SHA", "primary": "SHA", "other_db": "SHA", "filelists...).
Traceback (most recent call last):
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
   return self.cursor.execute(sql, params)
psycopg2.IntegrityError: null value in column "last_sync_revision_number" violates not-null constraint
DETAIL:  Failing row contains (9f9b589b-beb7-4b6a-ba6d-03eeb26d6d62, f, null, null, 0, null, {"other": "SHA", "primary": "SHA", "other_db": "SHA", "filelists...).
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/rq/worker.py", line 886, in perform_job
   rv = job.perform()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/rq/job.py", line 664, in perform
   self._result = self._execute()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/rq/job.py", line 670, in _execute
   return self.func(*self.args, **self.kwargs)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py", line 167, in synchronize
   dv.create()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulpcore/plugin/stages/declarative_version.py", line 149, in create
   loop.run_until_complete(pipeline)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulpcore/app/models/repository.py", line 787, in __exit__
   self.repository.save()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulpcore/app/models/repository.py", line 62, in save
   super().save(*args, **kwargs)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulpcore/app/models/base.py", line 107, in save
   return super().save(*args, **kwargs)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/models/base.py", line 741, in save
   force_update=force_update, update_fields=update_fields)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/models/base.py", line 779, in save_base
   force_update, using, update_fields,
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/models/base.py", line 851, in _save_table
   forced_update)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/models/base.py", line 900, in _do_update
   return filtered._update(values) > 0
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/models/query.py", line 760, in _update
   return query.get_compiler(self.db).execute_sql(CURSOR)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1469, in execute_sql
   cursor = super().execute_sql(result_type)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql
   cursor.execute(sql, params)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
   return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
   return executor(sql, params, many, context)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
   return self.cursor.execute(sql, params)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
   raise dj_exc_value.with_traceback(traceback) from exc_value
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
   return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: null value in column "last_sync_revision_number" violates not-null constraint

I beleive it is originating in app/tasks/synchronizing.py where repomd.revision is used. As it is None it can't be inserted in the table. If you remove the not null contraint from the column, the problem shifts to a comparison from a previous revision to a current. The repomd.revision can't be cast to a digit (None) and throws an error:

AttributeError: 'NoneType' object has no attribute 'isdigit'
Traceback (most recent call last):
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/rq/worker.py", line 886, in perform_job
   rv = job.perform()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/rq/job.py", line 664, in perform
   self._result = self._execute()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/rq/job.py", line 670, in _execute
   return self.func(*self.args, **self.kwargs)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py", line 167, in synchronize
   dv.create()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulpcore/plugin/stages/declarative_version.py", line 149, in create
   loop.run_until_complete(pipeline)
 File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
   return future.result()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 228, in create_pipeline
   await asyncio.gather(*futures)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 43, in __call__
   await self.run()
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py", line 346, in run
   is_previous_version(repomd.revision, self.repository.last_sync_revision_number)
 File "/var/lib/pulp/virtualenv/lib/python3.6/site-packages/pulp_rpm/app/shared_utils.py", line 49, in is_previous_version
   if version.isdigit() and target_version.isdigit():
AttributeError: 'NoneType' object has no attribute 'isdigit'

Installation is done on Oracle Linux 8.1 x86_64 via pip-method over version 3.3.0. DB is PostgreSQL 12 and Redis 5. Python 3.6

Also available in: Atom PDF