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

Log errors directly from inventory_import.py only if running by hand

This commit is contained in:
Jeff Bradberry 2019-03-27 18:02:46 -04:00
parent 196a6ff36c
commit a803e86a95

View File

@ -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