From 15f337d183b40eccc8831a74125fdc326faf0b08 Mon Sep 17 00:00:00 2001 From: Chris Church Date: Thu, 31 Oct 2013 15:04:57 -0400 Subject: [PATCH] AC-596 Fix for inventory import traceback. --- awx/main/management/commands/inventory_import.py | 4 ++-- awx/main/tests/commands.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index 7f38005980..cd964e9a02 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -363,7 +363,7 @@ def load_inventory_source(source, all_group=None): logger.debug('Analyzing type of source: %s', source) original_all_group = all_group if not os.path.exists(source): - raise CommandError('Source does not exist: %s' % source) + raise IOError('Source does not exist: %s' % source) if os.path.isdir(source): all_group = all_group or MemGroup('all', source) for filename in glob.glob(os.path.join(source, '*')): @@ -421,7 +421,7 @@ class Command(NoArgsCommand): class Formatter(logging.Formatter): def format(self, record): record.relativeSeconds = record.relativeCreated / 1000.0 - return super(Formatter, self).format(record) + return logging.Formatter.format(self, record) formatter = Formatter('%(relativeSeconds)9.3f %(levelname)-8s %(message)s') handler.setFormatter(formatter) self.logger.addHandler(handler) diff --git a/awx/main/tests/commands.py b/awx/main/tests/commands.py index 57c2e40514..583530610e 100644 --- a/awx/main/tests/commands.py +++ b/awx/main/tests/commands.py @@ -514,7 +514,7 @@ class InventoryImportTest(BaseCommandMixin, BaseLiveServerTest): result, stdout, stderr = self.run_command('inventory_import', inventory_id=inventory_id, source=invalid_source) - self.assertTrue(isinstance(result, CommandError), result) + self.assertTrue(isinstance(result, IOError), result) self.assertTrue('not exist' in str(result)) # Invalid inventory ID. invalid_id = Inventory.objects.order_by('-pk')[0].pk + 1