mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
AC-1278 Reduced the level of pickiness expressed by inventory_import regarding filenames.
This commit is contained in:
parent
c7ed154149
commit
6d0da4672d
@ -430,6 +430,8 @@ def load_inventory_source(source, all_group=None, group_filter_re=None,
|
||||
original_all_group = all_group
|
||||
if not os.path.exists(source):
|
||||
raise IOError('Source does not exist: %s' % source)
|
||||
source = os.path.join(os.path.dirname(source) or os.getcwd(), source)
|
||||
source = os.path.normpath(os.path.abspath(source))
|
||||
if os.path.isdir(source):
|
||||
all_group = all_group or MemGroup('all', source)
|
||||
for filename in glob.glob(os.path.join(source, '*')):
|
||||
|
@ -860,12 +860,14 @@ class InventoryImportTest(BaseCommandMixin, BaseLiveServerTest):
|
||||
new_inv = self.organizations[0].inventories.create(name='newec2')
|
||||
self.assertEqual(new_inv.hosts.count(), 0)
|
||||
self.assertEqual(new_inv.groups.count(), 0)
|
||||
inv_file = os.path.join(os.path.dirname(__file__), 'data',
|
||||
'large_ec2_inventory.py')
|
||||
#inv_file = os.path.join(os.path.dirname(__file__), 'data',
|
||||
# 'large_ec2_inventory.py')
|
||||
os.chdir(os.path.join(os.path.dirname(__file__), 'data'))
|
||||
inv_file = 'large_ec2_inventory.py'
|
||||
result, stdout, stderr = self.run_command('inventory_import',
|
||||
inventory_id=new_inv.pk,
|
||||
source=inv_file)
|
||||
self.assertEqual(result, None)
|
||||
self.assertEqual(result, None, stdout+stderr)
|
||||
# Check that inventory is populated as expected within a reasonable
|
||||
# amount of time. Computed fields should also be updated.
|
||||
new_inv = Inventory.objects.get(pk=new_inv.pk)
|
||||
|
Loading…
Reference in New Issue
Block a user