[Pulp-list] pulp2 migration: AccessPolicy matching query does not exist

Winberg Adam Adam.Winberg at smhi.se
Wed Oct 14 13:52:35 UTC 2020


Thanks for the reply!


I use 'flush' to clear the db, I don't have a 'reset_db' command. Otherwise that's pretty much my process.


The migrate command returns 'No migrations to apply'.

Running 'pulpcore-manager show-migrations' shows that all migrations, including 'guardian.0001/guardian.0002' has checkmarks ([X]).

guardian
 [X] 0001_initial
 [X] 0002_generic_permissions_index

The creation of the migration plan works so I assume my admin user is ok.


I am using an rpm based installation on RHEL8, with

python3-pulp-2to3-migration-0.4.0-1.el8.noarch
python3-pulp-rpm-3.7.0-1.el8.noarch
python3-pulpcore-3.7.1-3.el8.noarch


I don't know what went wrong, but I surrendered and dropped my DB and redid the migrations from scratch - and now it works.
Is there a documented instruction on upgrading existing installations?

//Adam



________________________________
From: Tatiana Tereshchenko <ttereshc at redhat.com>
Sent: 14 October 2020 14:15
To: Winberg Adam
Cc: pulp-list at redhat.com
Subject: Re: [Pulp-list] pulp2 migration: AccessPolicy matching query does not exist



On Wed, Oct 14, 2020 at 2:12 PM Tatiana Tereshchenko <ttereshc at redhat.com<mailto:ttereshc at redhat.com>> wrote:
Hi Adam,

My understanding is that you did the following:
 * stop pulp services
 * pulpcore-manager (or django-admin) reset_db
 * pulpcore-manager migrate
 * pulpcore-manager reset-admin-password --password password
 * start services
 * http POST :/pulp/api/v3/migration-plans/ < your_migraiton_plan.json
 * http POST :/pulp/api/v3/migration-plans/48d03a72-96a1-4d36-9f8b-9a57e97846ef/run/

Sent too early :)
I can't reproduce it so far, so any hints about what can be special about your environment or installation would be appreciated.
Make sure that you have at least one user which has admin privileges and that the guardian migrations ran indeed.
  Applying guardian.0001_initial... OK
  Applying guardian.0002_generic_permissions_index... OK

Tanya






On Wed, Oct 14, 2020 at 8:02 AM Winberg Adam <Adam.Winberg at smhi.se<mailto:Adam.Winberg at smhi.se>> wrote:

Hello,


so I updated my pulp3 installation from 3.4 to 3.7 and tried to rerun my pulp2 migration - but it errors out with "AccessPolicy matching query does not exist". Anyone know why?


I flushed my db, reran the 'migrate' job, created a pulp2migration plan (which worked fine) and then tried to run it. Here's the complete error:


Oct 14 05:43:26  gunicorn[2150852]: pulp: django.request:ERROR: Internal Server Error: /pulp/api/v3/migration-plans/48d03a72-96a1-4d36-9f8b-9a57e97846ef/run/
Oct 14 05:43:26  gunicorn[2150852]: Traceback (most recent call last):
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
Oct 14 05:43:26  gunicorn[2150852]:     response = get_response(request)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
Oct 14 05:43:26  gunicorn[2150852]:     response = self.process_exception_by_middleware(e, request)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
Oct 14 05:43:26  gunicorn[2150852]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
Oct 14 05:43:26  gunicorn[2150852]:     return view_func(*args, **kwargs)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/rest_framework/viewsets.py", line 114, in view
Oct 14 05:43:26  gunicorn[2150852]:     return self.dispatch(request, *args, **kwargs)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 505, in dispatch
Oct 14 05:43:26  gunicorn[2150852]:     response = self.handle_exception(exc)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 465, in handle_exception
Oct 14 05:43:26  gunicorn[2150852]:     self.raise_uncaught_exception(exc)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
Oct 14 05:43:26  gunicorn[2150852]:     raise exc
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 502, in dispatch
Oct 14 05:43:26  gunicorn[2150852]:     response = handler(request, *args, **kwargs)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/viewsets.py", line 85, in run
Oct 14 05:43:26  gunicorn[2150852]:     'dry_run': dry_run
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/pulpcore/tasking/tasks.py", line 236, in enqueue_with_reservation
Oct 14 05:43:26  gunicorn[2150852]:     **parent_kwarg,
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
Oct 14 05:43:26  gunicorn[2150852]:     return getattr(self.get_queryset(), name)(*args, **kwargs)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 422, in create
Oct 14 05:43:26  gunicorn[2150852]:     obj.save(force_insert=True, using=self.db)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django_lifecycle/mixins.py", line 132, in save
Oct 14 05:43:26  gunicorn[2150852]:     self._run_hooked_methods(AFTER_CREATE)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django_lifecycle/mixins.py", line 207, in _run_hooked_methods
Oct 14 05:43:26  gunicorn[2150852]:     method()
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django_lifecycle/decorators.py", line 69, in func
Oct 14 05:43:26  gunicorn[2150852]:     hooked_method(*args, **kwargs)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/pulpcore/app/models/access_policy.py", line 60, in add_perms
Oct 14 05:43:26  gunicorn[2150852]:     access_policy = AccessPolicy.objects.get(viewset_name=self.ACCESS_POLICY_VIEWSET_NAME)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
Oct 14 05:43:26  gunicorn[2150852]:     return getattr(self.get_queryset(), name)(*args, **kwargs)
Oct 14 05:43:26  gunicorn[2150852]:   File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 408, in get
Oct 14 05:43:26  gunicorn[2150852]:     self.model._meta.object_name
Oct 14 05:43:26  gunicorn[2150852]: pulpcore.app.models.access_policy.AccessPolicy.DoesNotExist: AccessPolicy matching query does not exist.



Regards

//Adam

_______________________________________________
Pulp-list mailing list
Pulp-list at redhat.com<mailto:Pulp-list at redhat.com>
https://www.redhat.com/mailman/listinfo/pulp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20201014/0718203e/attachment.htm>


More information about the Pulp-list mailing list