Re: [Pulp-list] pulp 3.3 db migration

2020-05-04 Thread Dennis Kliban
You could manually add null=True (keyword argument) to the definition of
the last_sync_revision_number here[0].

[0]
https://github.com/pulp/pulp_rpm/blob/3.3.0/pulp_rpm/app/migrations/0005_optimize_sync.py#L28

On Mon, May 4, 2020 at 4:19 PM Bin Li (BLOOMBERG/ 120 PARK) <
bli...@bloomberg.net> wrote:

> Is there a workaround or I cannot upgrade before this is fixed?
>
> Thanks
>
> From: dkli...@redhat.com At: 05/04/20 15:52:16
> To: Bin Li (BLOOMBERG/ 120 PARK ) 
> Cc: pulp-list@redhat.com
> Subject: Re: [Pulp-list] pulp 3.3 db migration
>
> Please file a bug.
>
> This is a problem with a migration that adds the ability to track when an
> RPM repository can skip syncing from the remote repository because the
> metadata is the same as it was during the previous sync. The migration is
> failing to provide a default value for databases that are being upgraded.
>
> On Mon, May 4, 2020 at 3:09 PM Bin Li (BLOOMBERG/ 120 PARK) <
> bli...@bloomberg.net> wrote:
>
>> Hi,
>>
>> Keep getting this error from ansible_install to upgrade from 3.2 to 3.3.
>> What could cause this and how can we fix it?
>>
>> Thanks
>>
>>
>> TASK [pulp-database : Run database migrations]
>> **
>> fatal: [pulp3-1]: FAILED! => {"changed": true, "cmd":
>> ["/opt/utils/venv/pulp/3.7.3/bin/django -admin", "migrate", "--no-input"],
>> "delta": "0:00:03.879347", "end": "2020-05-04 14:54:18.580 273", "msg":
>> "non-zero return code", "rc": 1, "start": "2020-05-04 14:54:14.700926",
>> "stderr" : "Traceback (most recent call last):\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/si
>> te-packages/django/db/backends/utils.py\", line 84, in _execute\n return
>> self.cursor.execu te(sql, params)\npsycopg2.errors.NotNullViolation: column
>> \"last_sync_revision_number\" conta ins null values\n\n\nThe above
>> exception was the direct cause of the following exception:\n\n Traceback
>> (most recent call last):\n File
>> \"/opt/utils/venv/pulp/3.7.3/bin/django-admin\", l ine 8, in \n
>> sys.exit(execute_from_command_line())\n File \"/opt/utils/venv/pulp/
>> 3.7.3/lib64/python3.7/site-packages/django/core/management/__init__.py\",
>> line 381, in execut e_from_command_line\n utility.execute()\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3
>> .7/site-packages/django/core/management/__init__.py\", line 375, in
>> execute\n self.fetch_c ommand(subcommand).run_from_argv(self.argv)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python
>> 3.7/site-packages/django/core/management/base.py\", line 323, in
>> run_from_argv\n self.exec ute(*args, **cmd_options)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/
>> django/core/management/base.py\", line 364, in execute\n output =
>> self.handle(*args, **opt ions)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/manageme
>> nt/base.py\", line 83, in wrapped\n res = handle_func(*args, **kwargs)\n
>> File \"/opt/util
>> s/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/commands/migrate.py\",
>> line 234, in handle\n fake_initial=fake_initial,\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib
>> 64/python3.7/site-packages/django/db/migrations/executor.py\", line 117, in
>> migrate\n stat e = self._migrate_all_forwards(state, plan, full_plan,
>> fake=fake, fake_initial=fake_initial)\ n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/execu
>> tor.py\", line 147, in _migrate_all_forwards\n state =
>> self.apply_migration(state, migrati on, fake=fake,
>> fake_initial=fake_initial)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.
>> 7/site-packages/django/db/migrations/executor.py\", line 245, in
>> apply_migration\n state = migration.apply(state, schema_editor)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/s
>> ite-packages/django/db/migrations/migration.py\", line 124, in apply\n
>> operation.database_ forwards(self.app_label, schema_editor, old_state,
>> project_state)\n File \"/opt/utils/venv/p
>> ulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/operations/fields.py\",
>> line 112 , in database_forwards\n field,\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-
>> packages/django/db/backends/base/schema.py\", line 447, in add_field\n
>> self.execute(sql, p arams)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/
>> base/schema.py\", line 137, in execute\n cursor.execute(sql, params)\n File
>> \"/opt/utils/
>> venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\",
>> line 67, in exec ute\n return self._execute_with_wrappers(sql, params,
>> many=False, executor=self._execute)\ n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.p
>> y\", line 76, in _execute_with_wrappers\n return executor(sql, params,
>> many, context)\n F ile
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\",
>> line 84, 

Re: [Pulp-list] pulp 3.3 db migration

2020-05-04 Thread Bin Li (BLOOMBERG/ 120 PARK)
Is there a workaround or I cannot upgrade before this is fixed?

Thanks

From: dkli...@redhat.com At: 05/04/20 15:52:16To:  Bin Li (BLOOMBERG/ 120 PARK 
) 
Cc:  pulp-list@redhat.com
Subject: Re: [Pulp-list] pulp 3.3 db migration

Please file a bug.

This is a problem with a migration that adds the ability to track when an RPM 
repository can skip syncing from the remote repository because the metadata is 
the same as it was during the previous sync. The migration is failing to 
provide a default value for databases that are being upgraded. 
On Mon, May 4, 2020 at 3:09 PM Bin Li (BLOOMBERG/ 120 PARK) 
 wrote:

Hi,

Keep getting this error from ansible_install to upgrade from 3.2 to 3.3. What 
could cause this and how can we fix it?

Thanks


TASK [pulp-database : Run database migrations] 
**
fatal: [pulp3-1]: FAILED! => {"changed": true, "cmd": 
["/opt/utils/venv/pulp/3.7.3/bin/django   -admin", 
"migrate", "--no-input"], "delta": "0:00:03.879347", "end": "2020-05-04 
14:54:18.580   273", "msg": "non-zero return code", "rc": 
1, "start": "2020-05-04 14:54:14.700926", "stderr"   : 
"Traceback (most recent call last):\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/si   
te-packages/django/db/backends/utils.py\", line 84, in _execute\nreturn 
self.cursor.execu   te(sql, 
params)\npsycopg2.errors.NotNullViolation: column \"last_sync_revision_number\" 
conta   ins null values\n\n\nThe above exception was the 
direct cause of the following exception:\n\n   Traceback 
(most recent call last):\n  File 
\"/opt/utils/venv/pulp/3.7.3/bin/django-admin\", l   ine 8, 
in \nsys.exit(execute_from_command_line())\n  File 
\"/opt/utils/venv/pulp/   
3.7.3/lib64/python3.7/site-packages/django/core/management/__init__.py\", line 
381, in execut   e_from_command_line\n
utility.execute()\n  File \"/opt/utils/venv/pulp/3.7.3/lib64/python3
   .7/site-packages/django/core/management/__init__.py\", line 375, in 
execute\nself.fetch_c   
ommand(subcommand).run_from_argv(self.argv)\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python   
3.7/site-packages/django/core/management/base.py\", line 323, in 
run_from_argv\nself.exec   ute(*args, **cmd_options)\n  
File \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/
   django/core/management/base.py\", line 364, in execute\noutput = 
self.handle(*args, **opt   ions)\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/manageme 
  nt/base.py\", line 83, in wrapped\nres = 
handle_func(*args, **kwargs)\n  File \"/opt/util   
s/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/commands/migrate.py\",
line 234, in handle\nfake_initial=fake_initial,\n  
File \"/opt/utils/venv/pulp/3.7.3/lib   
64/python3.7/site-packages/django/db/migrations/executor.py\", line 117, in 
migrate\nstat   e = self._migrate_all_forwards(state, 
plan, full_plan, fake=fake, fake_initial=fake_initial)\   n 
 File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/execu
   tor.py\", line 147, in _migrate_all_forwards\nstate 
= self.apply_migration(state, migrati   on, fake=fake, 
fake_initial=fake_initial)\n  File \"/opt/utils/venv/pulp/3.7.3/lib64/python3.  
 7/site-packages/django/db/migrations/executor.py\", line 
245, in apply_migration\nstate =
migration.apply(state, schema_editor)\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/s   
ite-packages/django/db/migrations/migration.py\", line 124, in apply\n
operation.database_   forwards(self.app_label, 
schema_editor, old_state, project_state)\n  File \"/opt/utils/venv/p
   
ulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/operations/fields.py\",
 line 112   , in database_forwards\nfield,\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-   
packages/django/db/backends/base/schema.py\", line 447, in add_field\n
self.execute(sql, p   arams)\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/  
 base/schema.py\", line 137, in execute\n
cursor.execute(sql, params)\n  File \"/opt/utils/   
venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\", 
line 67, in exec   ute\nreturn 

Re: [Pulp-list] pulp 3.3 db migration

2020-05-04 Thread Dennis Kliban
Please file a bug.

This is a problem with a migration that adds the ability to track when an
RPM repository can skip syncing from the remote repository because the
metadata is the same as it was during the previous sync. The migration is
failing to provide a default value for databases that are being upgraded.

On Mon, May 4, 2020 at 3:09 PM Bin Li (BLOOMBERG/ 120 PARK) <
bli...@bloomberg.net> wrote:

> Hi,
>
> Keep getting this error from ansible_install to upgrade from 3.2 to 3.3.
> What could cause this and how can we fix it?
>
> Thanks
>
>
> TASK [pulp-database : Run database migrations]
> **
> fatal: [pulp3-1]: FAILED! => {"changed": true, "cmd":
> ["/opt/utils/venv/pulp/3.7.3/bin/django -admin", "migrate", "--no-input"],
> "delta": "0:00:03.879347", "end": "2020-05-04 14:54:18.580 273", "msg":
> "non-zero return code", "rc": 1, "start": "2020-05-04 14:54:14.700926",
> "stderr" : "Traceback (most recent call last):\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/si
> te-packages/django/db/backends/utils.py\", line 84, in _execute\n return
> self.cursor.execu te(sql, params)\npsycopg2.errors.NotNullViolation: column
> \"last_sync_revision_number\" conta ins null values\n\n\nThe above
> exception was the direct cause of the following exception:\n\n Traceback
> (most recent call last):\n File
> \"/opt/utils/venv/pulp/3.7.3/bin/django-admin\", l ine 8, in \n
> sys.exit(execute_from_command_line())\n File \"/opt/utils/venv/pulp/
> 3.7.3/lib64/python3.7/site-packages/django/core/management/__init__.py\",
> line 381, in execut e_from_command_line\n utility.execute()\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3
> .7/site-packages/django/core/management/__init__.py\", line 375, in
> execute\n self.fetch_c ommand(subcommand).run_from_argv(self.argv)\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python
> 3.7/site-packages/django/core/management/base.py\", line 323, in
> run_from_argv\n self.exec ute(*args, **cmd_options)\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/
> django/core/management/base.py\", line 364, in execute\n output =
> self.handle(*args, **opt ions)\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/manageme
> nt/base.py\", line 83, in wrapped\n res = handle_func(*args, **kwargs)\n
> File \"/opt/util
> s/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/commands/migrate.py\",
> line 234, in handle\n fake_initial=fake_initial,\n File
> \"/opt/utils/venv/pulp/3.7.3/lib
> 64/python3.7/site-packages/django/db/migrations/executor.py\", line 117, in
> migrate\n stat e = self._migrate_all_forwards(state, plan, full_plan,
> fake=fake, fake_initial=fake_initial)\ n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/execu
> tor.py\", line 147, in _migrate_all_forwards\n state =
> self.apply_migration(state, migrati on, fake=fake,
> fake_initial=fake_initial)\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.
> 7/site-packages/django/db/migrations/executor.py\", line 245, in
> apply_migration\n state = migration.apply(state, schema_editor)\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/s
> ite-packages/django/db/migrations/migration.py\", line 124, in apply\n
> operation.database_ forwards(self.app_label, schema_editor, old_state,
> project_state)\n File \"/opt/utils/venv/p
> ulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/operations/fields.py\",
> line 112 , in database_forwards\n field,\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-
> packages/django/db/backends/base/schema.py\", line 447, in add_field\n
> self.execute(sql, p arams)\n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/
> base/schema.py\", line 137, in execute\n cursor.execute(sql, params)\n File
> \"/opt/utils/
> venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\",
> line 67, in exec ute\n return self._execute_with_wrappers(sql, params,
> many=False, executor=self._execute)\ n File
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.p
> y\", line 76, in _execute_with_wrappers\n return executor(sql, params,
> many, context)\n F ile
> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\",
> line 84, in _execute\n return self.cursor.execute(sql, params)\n File
> \"/opt/utils/venv/
> pulp/3.7.3/lib64/python3.7/site-packages/django/db/utils.py\", line 89, in
> __exit__\n rais e dj_exc_value.with_traceback(traceback) from exc_value\n
> File \"/opt/utils/venv/pulp/3.7.3/
> lib64/python3.7/site-packages/django/db/backends/utils.py\", line 84, in
> _execute\n return self.cursor.execute(sql,
> params)\ndjango.db.utils.IntegrityError: column \"last_sync_revisio
> n_number\" contains null values", "stderr_lines": ["Traceback (most recent
> call last):", " F ile
> 

[Pulp-list] pulp 3.3 db migration

2020-05-04 Thread Bin Li (BLOOMBERG/ 120 PARK)
Hi,

Keep getting this error from ansible_install to upgrade from 3.2 to 3.3. What 
could cause this and how can we fix it?

Thanks


TASK [pulp-database : Run database migrations] 
**
fatal: [pulp3-1]: FAILED! => {"changed": true, "cmd": 
["/opt/utils/venv/pulp/3.7.3/bin/django   -admin", 
"migrate", "--no-input"], "delta": "0:00:03.879347", "end": "2020-05-04 
14:54:18.580   273", "msg": "non-zero return code", "rc": 
1, "start": "2020-05-04 14:54:14.700926", "stderr"   : 
"Traceback (most recent call last):\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/si   
te-packages/django/db/backends/utils.py\", line 84, in _execute\nreturn 
self.cursor.execu   te(sql, 
params)\npsycopg2.errors.NotNullViolation: column \"last_sync_revision_number\" 
conta   ins null values\n\n\nThe above exception was the 
direct cause of the following exception:\n\n   Traceback 
(most recent call last):\n  File 
\"/opt/utils/venv/pulp/3.7.3/bin/django-admin\", l   ine 8, 
in \nsys.exit(execute_from_command_line())\n  File 
\"/opt/utils/venv/pulp/   
3.7.3/lib64/python3.7/site-packages/django/core/management/__init__.py\", line 
381, in execut   e_from_command_line\n
utility.execute()\n  File \"/opt/utils/venv/pulp/3.7.3/lib64/python3
   .7/site-packages/django/core/management/__init__.py\", line 375, in 
execute\nself.fetch_c   
ommand(subcommand).run_from_argv(self.argv)\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python   
3.7/site-packages/django/core/management/base.py\", line 323, in 
run_from_argv\nself.exec   ute(*args, **cmd_options)\n  
File \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/
   django/core/management/base.py\", line 364, in execute\noutput = 
self.handle(*args, **opt   ions)\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/manageme 
  nt/base.py\", line 83, in wrapped\nres = 
handle_func(*args, **kwargs)\n  File \"/opt/util   
s/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/commands/migrate.py\",
line 234, in handle\nfake_initial=fake_initial,\n  
File \"/opt/utils/venv/pulp/3.7.3/lib   
64/python3.7/site-packages/django/db/migrations/executor.py\", line 117, in 
migrate\nstat   e = self._migrate_all_forwards(state, 
plan, full_plan, fake=fake, fake_initial=fake_initial)\   n 
 File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/execu
   tor.py\", line 147, in _migrate_all_forwards\nstate 
= self.apply_migration(state, migrati   on, fake=fake, 
fake_initial=fake_initial)\n  File \"/opt/utils/venv/pulp/3.7.3/lib64/python3.  
 7/site-packages/django/db/migrations/executor.py\", line 
245, in apply_migration\nstate =
migration.apply(state, schema_editor)\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/s   
ite-packages/django/db/migrations/migration.py\", line 124, in apply\n
operation.database_   forwards(self.app_label, 
schema_editor, old_state, project_state)\n  File \"/opt/utils/venv/p
   
ulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/operations/fields.py\",
 line 112   , in database_forwards\nfield,\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-   
packages/django/db/backends/base/schema.py\", line 447, in add_field\n
self.execute(sql, p   arams)\n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/  
 base/schema.py\", line 137, in execute\n
cursor.execute(sql, params)\n  File \"/opt/utils/   
venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\", 
line 67, in exec   ute\nreturn 
self._execute_with_wrappers(sql, params, many=False, executor=self._execute)\   
n  File 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.p
   y\", line 76, in _execute_with_wrappers\nreturn 
executor(sql, params, many, context)\n  F   ile 
\"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\",
line 84, in _execute\nreturn 
self.cursor.execute(sql, params)\n  File \"/opt/utils/venv/ 
  pulp/3.7.3/lib64/python3.7/site-packages/django/db/utils.py\", line