From a803e86a9536da149bc229db4f8f95bfc551c260 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Wed, 27 Mar 2019 18:02:46 -0400 Subject: [PATCH] Log errors directly from inventory_import.py only if running by hand --- awx/main/management/commands/inventory_import.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index ed6cf953e4..d5056d9a51 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -1120,7 +1120,7 @@ class Command(BaseCommand): tb = traceback.format_exc() exc = e - if self.invoked_from_dispatcher is False: + if not self.invoked_from_dispatcher: with ignore_inventory_computed_fields(): self.inventory_update = InventoryUpdate.objects.get(pk=self.inventory_update.pk) self.inventory_update.result_traceback = tb @@ -1129,8 +1129,10 @@ class Command(BaseCommand): self.inventory_source.status = status self.inventory_source.save(update_fields=['status']) + if exc: + logger.error(str(exc)) + if exc: - logger.error(str(exc)) if isinstance(exc, CommandError): sys.exit(1) raise exc