Issue #3210
closedUpdate Importer configuration fails.
Description
Updating the importer config fails.
To recreate, PUT pulp/api/v2/repositories/<id>/importers/<id>/
produces the trace:
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) Task pulp.server.managers.repo.importer.update_importer_config[8a2b6d45-1829-4560-b441-055e6adb56f3] raised unexpec
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) Traceback (most recent call last):
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) R = retval = fun(*args, **kwargs)
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) File "/home/jortel/git/pulp/server/pulp/server/async/tasks.py", line 529, in __call__
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) return super(Task, self).__call__(*args, **kwargs)
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) File "/home/jortel/git/pulp/server/pulp/server/async/tasks.py", line 107, in __call__
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) return super(PulpTask, self).__call__(*args, **kwargs)
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) return self.run(*args, **kwargs)
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) File "/home/jortel/git/pulp/server/pulp/server/controllers/importer.py", line 277, in update_importer_config
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) repo_importer.save()
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) File "/home/jortel/git/pulp/server/pulp/server/db/model/__init__.py", line 291, in save
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) super(Importer, self).save()
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) File "/usr/lib/python2.7/site-packages/mongoengine/document.py", line 398, in save
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) raise OperationError(message % unicode(err))
Dec 15 15:39:51 f25d.redhat.com pulp[20619]: celery.worker.job:ERROR: (20619-02688) OperationError: Could not save document (Cannot update 'config' and 'config.feed' at the same time)
After some investigation, it seems to be data dependant. I tried various combinations of changing values and setting some to NULL which causes a dict.pop() but haven't found the magic combination yet.
This was found posting to update the OSTree importer but I'm convinced the problem is in the core. This PUT body reproduces is for me.
{
"importer_config":{
"basic_auth_username": null,
"basic_auth_password": null,
"depth":44,
"feed":"http://xx"
}
}
Updated by ttereshc over 5 years ago
I observed similar issue with errata model at some point. Mongo doesn't let you change a document and the document/object nested into it.
You probably had a feed
before and you changed it, at the same time you probably didn't have depth
and you added it (new key to the config dict). If it was done sequencially, it would work. That's my guess.
An additional save
call on the importer model may solve the issue. I'll take a look.
Updated by ttereshc over 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to ttereshc
Updated by ttereshc over 5 years ago
- Status changed from ASSIGNED to POST
https://github.com/pulp/pulp/pull/3247
The problem is in removing a key from a DictField (even an attempt of @pop@ing non-existing one) at the same time as updating a value of the same DictField.
Updated by ttereshc over 5 years ago
Probably the same change should be done for a distributor if the suggested approach in the PR ^ will be accepted.
Added by ttereshc over 5 years ago
Updated by ttereshc about 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulp|80c7b96afbf80937e0406b3c22857169aafe5b46.
Added by ttereshc about 5 years ago
Save importer config in a proper way for MongoDB DictField
MongoDB does not allow to change keys of the DictField and values of the same DictField simultaneously thus we need to save importer config twice.
closes #3210 https://pulp.plan.io/issues/3210
(cherry picked from commit 80c7b96afbf80937e0406b3c22857169aafe5b46)
Updated by ttereshc about 5 years ago
Applied in changeset pulp|ec118d32a28cad41ba5e2ab43c20c7710a84efc7.
Updated by pcreech about 5 years ago
- Status changed from 5 to CLOSED - CURRENTRELEASE
Save importer config in a proper way for MongoDB DictField
MongoDB does not allow to change keys of the DictField and values of the same DictField simultaneously thus we need to save importer config twice.
closes #3210 https://pulp.plan.io/issues/3210