Project

Profile

Help

Issue #3210

closed

Update Importer configuration fails.

Added by jortel@redhat.com over 6 years ago. Updated almost 3 years ago.

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

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"
  }
}
Actions #2

Updated by ttereshc over 6 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.

Actions #4

Updated by ttereshc about 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ttereshc
Actions #6

Updated by ttereshc about 6 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.

Actions #7

Updated by ttereshc about 6 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 about 6 years ago

Revision 80c7b96a | View on GitHub

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

Actions #8

Updated by amacdona@redhat.com about 6 years ago

  • Triaged changed from No to Yes
Actions #9

Updated by dalley about 6 years ago

Removed bz marked as duplicate

Actions #11

Updated by ttereshc about 6 years ago

  • Status changed from POST to MODIFIED
Actions #12

Updated by pcreech about 6 years ago

  • Platform Release set to 2.15.1

Added by ttereshc about 6 years ago

Revision ec118d32 | View on GitHub

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)

Actions #14

Updated by pcreech about 6 years ago

  • Status changed from MODIFIED to 5
Actions #15

Updated by pcreech about 6 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE
Actions #17

Updated by bmbouter almost 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF