From 5a54c46421a8845b65702bbeada232ee368efe84 Mon Sep 17 00:00:00 2001 From: mabezi <92539850+mabezi@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:19:46 +0200 Subject: [PATCH] add note about arguments in shebang in modules (#1718) * add note about arguments in shebang in modules * update note about arguments in shebang in modules * move notes about shebang in one warning (cherry picked from commit 90766243510da5f78cb8fbf69ff409a6748e327d) --- docs/docsite/rst/dev_guide/developing_modules_documenting.rst | 4 +++- docs/docsite/rst/reference_appendices/faq.rst | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/docsite/rst/dev_guide/developing_modules_documenting.rst b/docs/docsite/rst/dev_guide/developing_modules_documenting.rst index 639a6f96a76..db200dfb250 100644 --- a/docs/docsite/rst/dev_guide/developing_modules_documenting.rst +++ b/docs/docsite/rst/dev_guide/developing_modules_documenting.rst @@ -32,7 +32,9 @@ Python shebang & UTF-8 coding Begin your Ansible module with ``#!/usr/bin/python`` - this "shebang" allows ``ansible_python_interpreter`` to work. Follow the shebang immediately with ``# -*- coding: utf-8 -*-`` to clarify that the file is UTF-8 encoded. -.. note:: Using ``#!/usr/bin/env``, makes ``env`` the interpreter and bypasses ``ansible__interpreter`` logic. +.. warning:: + - Using ``#!/usr/bin/env`` makes ``env`` the interpreter and bypasses ``ansible__interpreter`` logic. + - Passing arguments to the interpreter in the shebang does not work (for example, ``#!/usr/bin/env python``) . .. note:: If you develop the module using a different scripting language, adjust the interpreter accordingly (``#!/usr/bin/``) so ``ansible__interpreter`` can work for that specific language. .. note:: Binary modules do not require a shebang or an interpreter. diff --git a/docs/docsite/rst/reference_appendices/faq.rst b/docs/docsite/rst/reference_appendices/faq.rst index 9f7a288b107..2f27b3f37c2 100644 --- a/docs/docsite/rst/reference_appendices/faq.rst +++ b/docs/docsite/rst/reference_appendices/faq.rst @@ -182,7 +182,8 @@ Also, this works for ANY interpreter, for example ruby: ``ansible_ruby_interpret so you can use this for custom modules written in any scripting language and control the interpreter location. Keep in mind that if you put ``env`` in your module shebang line (``#!/usr/bin/env ``), -this facility will be ignored so you will be at the mercy of the remote `$PATH`. +this won't work and will be evaluated as one string (including the space between ``env`` and ```` space). +Arguments are neither intended nor supported. .. _installation_faqs: