From 52a0165c77bb21765978f364e819e62222e1e0af Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 24 May 2016 10:25:10 -0400 Subject: [PATCH] skip non executable inventory when no shebang (#15969) alternate fix #15934 --- lib/ansible/inventory/dir.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/inventory/dir.py b/lib/ansible/inventory/dir.py index 5a3d25fe5e..ab18773dbf 100644 --- a/lib/ansible/inventory/dir.py +++ b/lib/ansible/inventory/dir.py @@ -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