Operations fail with: "Creation hook 'add_for_object_creator' was not registered for this view set."

Problem:
It has been reported that after upgrading to 3.20, some access policies have not been properly migrated to the roles framework. This leads to some operations failing with errors like “Creation hook ‘add_for_object_creator’ was not registered for this view set.”.
While it is yet to be investigated how this situation can emerge, there is a rather simple workaround.

Note: Pulp will not attempt to update customized access policies at all. If you have some, you need to adjust them manually in any case.

Solution:

  1. Use the pulp CLI to find all the access policies not being updated:
    pulp access-policy list --limit 1000 and search for add_for_object_creator in the creation hooks.
  2. Identify the viewset_name of the corresponding policies and reset them to their default:
    pulp access-policy reset --viewset-name <VIEWSET_NAME>
  3. Restart all pulp services.

To reset all access policies in one go, you could use:
pulp access-policy list --limit 1000 | jq -r '.[].viewset_name' | xargs -n1 pulp access-policy reset --viewset-name

Other relevant data:
Related bugreport: https://github.com/pulp/pulpcore/issues/3080

1 Like