mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
skip non executable inventory when no shebang (#15969)
alternate fix #15934
This commit is contained in:
parent
f9c4fdab40
commit
52a0165c77
1 changed files with 2 additions and 2 deletions
|
@ -65,7 +65,7 @@ def get_file_parser(hostsfile, groups, loader):
|
|||
myerr.append("The file %s looks like it should be an executable inventory script, but is not marked executable. Perhaps you want to correct this with `chmod +x %s`?" % (hostsfile, hostsfile))
|
||||
|
||||
# YAML/JSON
|
||||
if not processed and os.path.splitext(hostsfile)[-1] in C.YAML_FILENAME_EXTENSIONS:
|
||||
if not processed and not shebang_present and os.path.splitext(hostsfile)[-1] in C.YAML_FILENAME_EXTENSIONS:
|
||||
try:
|
||||
parser = InventoryYAMLParser(loader=loader, groups=groups, filename=hostsfile)
|
||||
processed = True
|
||||
|
@ -73,7 +73,7 @@ def get_file_parser(hostsfile, groups, loader):
|
|||
myerr.append(str(e))
|
||||
|
||||
# ini
|
||||
if not processed:
|
||||
if not processed and not shebang_present:
|
||||
try:
|
||||
parser = InventoryINIParser(loader=loader, groups=groups, filename=hostsfile)
|
||||
processed = True
|
||||
|
|
Loading…
Reference in a new issue