mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 03:47:36 -02:30
Merge pull request #43 from chrismeyersfsu/improvement-inventory_import_more_like_ansible
inventory_import behave more like ansible
This commit is contained in:
@@ -55,12 +55,16 @@ class MemObject(object):
|
|||||||
|
|
||||||
def load_vars(self, base_path):
|
def load_vars(self, base_path):
|
||||||
all_vars = {}
|
all_vars = {}
|
||||||
|
files_found = 0
|
||||||
for suffix in ('', '.yml', '.yaml', '.json'):
|
for suffix in ('', '.yml', '.yaml', '.json'):
|
||||||
path = ''.join([base_path, suffix])
|
path = ''.join([base_path, suffix])
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
continue
|
continue
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
continue
|
continue
|
||||||
|
files_found += 1
|
||||||
|
if files_found > 1:
|
||||||
|
raise RuntimeError('Multiple variable files found. There should only be one. %s ' % self.name)
|
||||||
vars_name = os.path.basename(os.path.dirname(path))
|
vars_name = os.path.basename(os.path.dirname(path))
|
||||||
logger.debug('Loading %s from %s', vars_name, path)
|
logger.debug('Loading %s from %s', vars_name, path)
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user