From ec55603e3fd96a8cb83953867d056913e03937dd Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 5 Nov 2014 16:07:57 -0600 Subject: [PATCH] Fixing various small issues to improve tests. --- awx/main/queue.py | 3 ++- awx/main/utils.py | 4 +--- awx/plugins/callback/job_event_callback.py | 12 ++++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/awx/main/queue.py b/awx/main/queue.py index a543838ad0..8ea30702f6 100644 --- a/awx/main/queue.py +++ b/awx/main/queue.py @@ -17,7 +17,8 @@ redis_kwargs = {} broker_url = settings.BROKER_URL if not broker_url.lower().startswith('redis://'): raise RuntimeError('Error importing awx.main.queue: Cannot use queue with ' - 'a non-Redis broker configured for celery.') + 'a non-Redis broker configured for celery.\n' + 'Broker is set to: %s' % broker_url) broker_url = broker_url[8:] # There may or may not be a password; address both situations by checking diff --git a/awx/main/utils.py b/awx/main/utils.py index 53b104862f..d1b8a83f06 100644 --- a/awx/main/utils.py +++ b/awx/main/utils.py @@ -18,9 +18,6 @@ from rest_framework.exceptions import ParseError, PermissionDenied # PyCrypto from Crypto.Cipher import AES -# Tower -from awx.main.queue import PubSub - __all__ = ['get_object_or_400', 'get_object_or_403', 'camelcase_to_underscore', 'get_ansible_version', 'get_awx_version', 'update_scm_url', @@ -364,6 +361,7 @@ def get_system_task_capacity(): def emit_websocket_notification(endpoint, event, payload): + from awx.main.queue import PubSub pubsub = PubSub('websocket') payload['event'] = event payload['endpoint'] = endpoint diff --git a/awx/plugins/callback/job_event_callback.py b/awx/plugins/callback/job_event_callback.py index da210f2c70..7b81f23597 100644 --- a/awx/plugins/callback/job_event_callback.py +++ b/awx/plugins/callback/job_event_callback.py @@ -170,10 +170,14 @@ class CallbackModule(object): event_data['task'] = task_name if role_name and event not in self.EVENTS_WITHOUT_TASK: event_data['role'] = role_name - if self.callback_consumer_port: - self._post_job_event_queue_msg(event, event_data) - else: - self._post_rest_api_event(event, event_data) + + # FIXME: + # This seems to check if anything is listening for the callback. + # We probably need to duplicate this in the new Redis system. + # if self.callback_consumer_port: + self._post_job_event_queue_msg(event, event_data) + # else: + # self._post_rest_api_event(event, event_data) def on_any(self, *args, **kwargs): pass