Git Product home page Git Product logo

Comments (5)

resmo avatar resmo commented on June 17, 2024

Thanks @aueam for your contribution,

The shebang is a requirement of Ansible and how Ansible work, the shebang in modules is not useless, even though they are not executable (and were nevert meant to be executable as is).

Ansible does some magic packaging before they get transferred to the target and executed, including some module utils which you see in the modules. (AFAIR the shebang will be replaced to whatever ansible_python_interpreter points to)

Read more about the requirement https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html#python-shebang-utf-8-coding

from ansible-collection-vultr.

mtelka avatar mtelka commented on June 17, 2024

Interesting, @resmo. I believe the ansible_python_interpreter logic simply replaces the #!/usr/bin/python shebang by whatever is Python on the target machine (for example #!/usr/bin/python3) and then the particular file is executed (if it is meant to be executed). In this particular case I believe these files are not executed, but instead imported as Python modules.

OTOH, it is easily possible that I'm wrong here, so please could you show us what ansible does (or could do) with those files to make them executable by utilizing their shebang?

Thank you.

from ansible-collection-vultr.

mtelka avatar mtelka commented on June 17, 2024

In addition, for the plugins/inventory/vultr.py file the current shebang does not follow the rule you are referring to :-).

from ansible-collection-vultr.

resmo avatar resmo commented on June 17, 2024

indeed, ironically there shouldn't be a shebang in an inventory plugin because it's executed on the controller.

from ansible-collection-vultr.

mtelka avatar mtelka commented on June 17, 2024

I found this: https://docs.ansible.com/ansible/latest/dev_guide/testing/sanity/shebang.html

So it looks like ansible really requires shebang in modules even they are not executable.

I think this bug report could be closed.

from ansible-collection-vultr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.