1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Change strings used for job events, do not use exception middleware that was masking error, do

not log callbacks for vars_files imports.
This commit is contained in:
Michael DeHaan 2013-07-02 11:32:43 -04:00
parent ea72058e9c
commit 78eac4834e
3 changed files with 36 additions and 28 deletions

View File

@ -970,27 +970,31 @@ class JobEvent(models.Model):
EVENT_TYPES = [ EVENT_TYPES = [
# (level, event, verbose name, failed) # (level, event, verbose name, failed)
(3, 'runner_on_failed', _('Runner on Failed'), True), (3, 'runner_on_failed', _('Host Failed'), True),
(3, 'runner_on_ok', _('Runner on OK'), False), (3, 'runner_on_ok', _('Host OK'), False),
(3, 'runner_on_error', _('Runner on Error'), True), (3, 'runner_on_error', _('Host Failure'), True),
(3, 'runner_on_skipped', _('Runner on Skipped'), False), (3, 'runner_on_skipped', _('Host Skipped'), False),
(3, 'runner_on_unreachable', _('Runner on Unreachable'), True), (3, 'runner_on_unreachable', _('Host Unreachable'), True),
(3, 'runner_on_no_hosts', _('Runner on No Hosts'), False), (3, 'runner_on_no_hosts', _('No Hosts Remaining'), False),
(3, 'runner_on_async_poll', _('Runner on Async Poll'), False), (3, 'runner_on_async_poll', _('Host Polling'), False),
(3, 'runner_on_async_ok', _('Runner on Async OK'), False), (3, 'runner_on_async_ok', _('Host OK'), False),
(3, 'runner_on_async_failed', _('Runner on Async Failed'), True), (3, 'runner_on_async_failed', _('Host Failure'), True),
(3, 'runner_on_file_diff', _('Runner on File Diff'), False), # AWX does not yet support --diff mode
(0, 'playbook_on_start', _('Playbook on Start'), False), (3, 'runner_on_file_diff', _('File Difference'), False),
(2, 'playbook_on_notify', _('Playbook on Notify'), False), (0, 'playbook_on_start', _('Playbook Started'), False),
(2, 'playbook_on_no_hosts_matched', _('Playbook on No Hosts Matched'), False), (2, 'playbook_on_notify', _('Running Handlers'), False),
(2, 'playbook_on_no_hosts_remaining', _('Playbook on No Hosts Remaining'), False), (2, 'playbook_on_no_hosts_matched', _('No Hosts Matched'), False),
(2, 'playbook_on_task_start', _('Playbook on Task Start'), False), (2, 'playbook_on_no_hosts_remaining', _('No Hosts Remaining'), False),
(1, 'playbook_on_vars_prompt', _('Playbook on Vars Prompt'), False), (2, 'playbook_on_task_start', _('Task Started'), False),
(2, 'playbook_on_setup', _('Playbook on Setup'), False), # AWX does not yet support vars_prompt (and will probably hang :)
(2, 'playbook_on_import_for_host', _('Playbook on Import for Host'), False), (1, 'playbook_on_vars_prompt', _('Variables Prompted'), False),
(2, 'playbook_on_not_import_for_host', _('Playbook on Not Import for Host'), False), (2, 'playbook_on_setup', _('Gathering Facts'), False),
(1, 'playbook_on_play_start', _('Playbook on Play Start'), False), # callback will not record this
(1, 'playbook_on_stats', _('Playbook on Stats'), False), (2, 'playbook_on_import_for_host', _('internal: on Import for Host'), False),
# callback will not record this
(2, 'playbook_on_not_import_for_host', _('internal: on Not Import for Host'), False),
(1, 'playbook_on_play_start', _('Play Started'), False),
(1, 'playbook_on_stats', _('Playbook Complete'), False),
] ]
FAILED_EVENTS = [x[1] for x in EVENT_TYPES if x[3]] FAILED_EVENTS = [x[1] for x in EVENT_TYPES if x[3]]
EVENT_CHOICES = [(x[1], x[2]) for x in EVENT_TYPES] EVENT_CHOICES = [(x[1], x[2]) for x in EVENT_TYPES]
@ -1062,8 +1066,7 @@ class JobEvent(models.Model):
return self.LEVEL_FOR_EVENT.get(self.event, 0) return self.LEVEL_FOR_EVENT.get(self.event, 0)
def get_event_display2(self): def get_event_display2(self):
# FIXME: Remove extra spaces once hierarchy view is in place. return self.get_event_display()
return '%s%s' % (u'\u00a0\u00a0\u00a0\u00a0' * self.event_level, self.get_event_display())
def _find_parent(self): def _find_parent(self):
parent_events = set() parent_events = set()

View File

@ -175,12 +175,16 @@ class CallbackModule(object):
self._log_event('playbook_on_setup') self._log_event('playbook_on_setup')
def playbook_on_import_for_host(self, host, imported_file): def playbook_on_import_for_host(self, host, imported_file):
self._log_event('playbook_on_import_for_host', host=host, # don't care about recording this one
imported_file=imported_file) # self._log_event('playbook_on_import_for_host', host=host,
# imported_file=imported_file)
pass
def playbook_on_not_import_for_host(self, host, missing_file): def playbook_on_not_import_for_host(self, host, missing_file):
self._log_event('playbook_on_not_import_for_host', host=host, # don't care about recording this one
missing_file=missing_file) #self._log_event('playbook_on_not_import_for_host', host=host,
# missing_file=missing_file)
pass
def playbook_on_play_start(self, pattern): def playbook_on_play_start(self, pattern):
self._log_event('playbook_on_play_start', pattern=pattern) self._log_event('playbook_on_play_start', pattern=pattern)

View File

@ -98,7 +98,8 @@ TEMPLATE_CONTEXT_PROCESSORS += (
) )
MIDDLEWARE_CLASSES += ( MIDDLEWARE_CLASSES += (
'awx.middleware.exceptions.ExceptionMiddleware', # masking 500 errors do not use for now?
# 'awx.middleware.exceptions.ExceptionMiddleware',
'django.middleware.transaction.TransactionMiddleware', 'django.middleware.transaction.TransactionMiddleware',
# middleware loaded after this point will be subject to transactions # middleware loaded after this point will be subject to transactions
) )