Project

Profile

Help

Issue #1216

Updating a pulp repo importer settings via api causes an error

Added by paji@redhat.com about 5 years ago. Updated 4 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
2.7.0 Beta
Platform Release:
2.7.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
Quarter:

Description

While updating an ostree branch via pulp api/katello we hit upon the following error.

Aug 27 08:18:12 katello-kant qpidd[2483]: 2015-08-27 08:18:12 [Network] info Set TCP_NODELAY on connection to 192.168.100.215:50552
Aug 27 08:18:12 katello-kant qpidd[2483]: 2015-08-27 08:18:12 [Network] info Set TCP_NODELAY on connection to 192.168.100.215:50553
Aug 27 08:18:12 katello-kant pulp: kombu.transport.qpid:INFO: Connected to qpid with SASL mechanism PLAIN
Aug 27 08:18:12 katello-kant pulp: kombu.transport.qpid:INFO: Connected to qpid with SASL mechanism PLAIN
Aug 27 08:18:12 katello-kant qpidd[2483]: 2015-08-27 08:18:12 [Broker] info Queue "84ed131c-c461-48c8-9b97-fbc6752bc158:1.0": Flow limit created: flowStopCount=0, flowResumeCount=0, flowStopSize=83886080, flowResumeSize=73400320
Aug 27 08:18:12 katello-kant qpidd[2483]: 2015-08-27 08:18:12 [Broker] info Queue "9fcb329a-78ac-42f2-af35-035c64af8c24:1.0": Flow limit created: flowStopCount=0, flowResumeCount=0, flowStopSize=83886080, flowResumeSize=73400320
Aug 27 08:18:12 katello-kant pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._queue_reserved_task[8d57d7de-dedf-4708-8531-a7891ac26cdf]
Aug 27 08:18:12 katello-kant pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._queue_reserved_task[ff7c90e2-d935-41ff-b013-96fe91f5b8ce]
Aug 27 08:18:12 katello-kant qpidd[2483]: 2015-08-27 08:18:12 [Network] info Set TCP_NODELAY on connection to 192.168.100.215:50555
Aug 27 08:18:12 katello-kant pulp: kombu.transport.qpid:INFO: Connected to qpid with SASL mechanism PLAIN
Aug 27 08:18:12 katello-kant qpidd[2483]: 2015-08-27 08:18:12 [Broker] info Queue "87d8a98b-4e7e-4a9c-9a5c-fdf780b6b074:1.0": Flow limit created: flowStopCount=0, flowResumeCount=0, flowStopSize=83886080, flowResumeSize=73400320
Aug 27 08:18:12 katello-kant pulp: celery.worker.strategy:INFO: Received task: pulp.server.managers.repo.importer.update_importer_config[729894d2-4890-4788-851e-701cd15ad913]
Aug 27 08:18:12 katello-kant pulp: celery.worker.job:INFO: Task pulp.server.async.tasks._queue_reserved_task[8d57d7de-dedf-4708-8531-a7891ac26cdf] succeeded in 0.178897220998s: None
Aug 27 08:18:12 katello-kant pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._release_resource[cc1bd624-c823-41fb-b8c6-c3408ac0cb18]
Aug 27 08:18:13 katello-kant pulp: celery.worker.strategy:INFO: Received task: pulp.server.tasks.repository.distributor_update[7d6187dc-b565-42fc-b144-507110bb1d3d]
Aug 27 08:18:13 katello-kant pulp: pulp.server.async.tasks:INFO: Task failed : [729894d2-4890-4788-851e-701cd15ad913]
Aug 27 08:18:13 katello-kant pulp: celery.worker.strategy:INFO: Received task: pulp.server.async.tasks._release_resource[3a6ff815-2dd4-494f-883c-ebf572e4fe86]
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776) Task pulp.server.managers.repo.importer.update_importer_config[729894d2-4890-4788-851e-701cd15ad913] raised unexpected: ImproperlyConfigured('Requested setting ROOT_URLCONF, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.',)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776) Traceback (most recent call last):
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     R = retval = fun(*args, **kwargs)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 394, in __call__
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     return super(Task, self).__call__(*args, **kwargs)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 437, in __protected_call__
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     return self.run(*args, **kwargs)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/pulp/server/managers/repo/importer.py", line 300, in update_importer_config
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     return serializer.data
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/serializers/__init__.py", line 128, in data
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     return self._to_representation(self.instance)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/serializers/__init__.py", line 76, in _to_representation
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     href = self.get_href(instance)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/serializers/__init__.py", line 172, in get_href
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     'importer_id': instance['id']})
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/django/core/urlresolvers.py", line 485, in reverse
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     resolver = get_resolver(urlconf)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 32, in wrapper
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     result = func(*args)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/django/core/urlresolvers.py", line 125, in get_resolver
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     urlconf = settings.ROOT_URLCONF
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     self._setup(name)
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 47, in _setup
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776)     % (desc, ENVIRONMENT_VARIABLE))
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:ERROR: (3194-51776) ImproperlyConfigured: Requested setting ROOT_URLCONF, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:INFO: Task pulp.server.async.tasks._release_resource[cc1bd624-c823-41fb-b8c6-c3408ac0cb18] succeeded in 0.0101205790052s: None
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:INFO: Task pulp.server.tasks.repository.distributor_update[7d6187dc-b565-42fc-b144-507110bb1d3d] succeeded in 0.0103635869964s: <pulp.server.async.tasks.TaskResult object at 0x7fc3f8023350>
Aug 27 08:18:13 katello-kant pulp: celery.worker.job:INFO: Task pulp.server.async.tasks._release_resource[3a6ff815-2dd4-494f-883c-ebf572e4fe86] succeeded in 0.0115494749989s: None
Aug 27 08:18:30 katello-kant journal: Suppressed 663 messages from /user.slice/user-1000.slice

Related issues

Has duplicate Pulp - Issue #1242: Django setting undefined error in importer updateCLOSED - DUPLICATE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision a7ec3aea View on GitHub
Added by dkliban@redhat.com about 5 years ago

Adds django settings environment variable to all celery processes

re #1216 https://pulp.plan.io/issues/1216

Revision a7ec3aea View on GitHub
Added by dkliban@redhat.com about 5 years ago

Adds django settings environment variable to all celery processes

re #1216 https://pulp.plan.io/issues/1216

History

#1 Updated by bmbouter about 5 years ago

  • Description updated (diff)
  • Tags Easy Fix added

The root cause of this bug is that the Celery code doesn't know how to find the settings file. I believe currently only httpd knows where the settings file is. The fix is to ensure that all Pulp components know how to find the settings file. All entry points for celery processes need to ensure they set the environment variable like this:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pulp.server.webservices.settings")

I'll also suggest this becomes a constant in pulp server so that we don't duplicate the string we are setting here.

This is where httpd does it for example: https://github.com/pulp/pulp/blob/fa1af4fbc6f37874879a4eb209ff2b57efc16a5d/server/pulp/server/webservices/wsgi.py#L11

#2 Updated by dkliban@redhat.com about 5 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to dkliban@redhat.com

#3 Updated by mhrivnak about 5 years ago

  • Priority changed from Normal to High
  • Severity changed from 2. Medium to 3. High
  • Triaged changed from No to Yes

#4 Updated by dkliban@redhat.com about 5 years ago

  • Status changed from ASSIGNED to MODIFIED
  • Platform Release set to 2.7.0

#5 Updated by bmbouter about 5 years ago

  • Has duplicate Issue #1242: Django setting undefined error in importer update added

#6 Updated by dkliban@redhat.com about 5 years ago

  • Status changed from MODIFIED to 5

#7 Updated by amacdona@redhat.com almost 5 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE

#8 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

#9 Updated by bmbouter 4 months ago

  • Category deleted (14)

We are removing the 'API' category per open floor discussion June 16, 2020.

Please register to edit this issue

Also available in: Atom PDF