From 046385d72ebd0050d0cdffa38099dfca6e53e363 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Thu, 21 Feb 2019 15:57:44 -0500 Subject: [PATCH] Make the inventory_import command log an error message on exception when it happens in the big try/except block in the middle of handle(). Previously it wasn't doing anything with it, except exiting with a code of 1. --- awx/main/management/commands/inventory_import.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index 0974dcb7fa..af4c2d88d7 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -1104,7 +1104,8 @@ class Command(BaseCommand): self.inventory_source.status = status self.inventory_source.save(update_fields=['status']) - if exc and isinstance(exc, CommandError): - sys.exit(1) - elif exc: + if exc: + logger.error(str(exc)) + if isinstance(exc, CommandError): + sys.exit(1) raise exc