Giter Club home page Giter Club logo

Comments (5)

ansibot avatar ansibot commented on May 24, 2024

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

from ansible.

bcoca avatar bcoca commented on May 24, 2024

This is not really an ansible-inventory issue but how the script inventory plugin works.

from ansible.

nitzmahone avatar nitzmahone commented on May 24, 2024

Closing as above- if you need to debug a script, just run the script (or better yet: write an inventory plugin and use a debugger).

from ansible.

cgte avatar cgte commented on May 24, 2024

@nitzmahone I ran the script from command line (./myscript.py) withtout error and could print / breakpoint().
But could not print anything to screen and brakpoint() / pdb.set_trace() would hang if ran from ansible-inventory .

I am not sure whether starting to write my own plugin for debugging purposes on a tool i am still learning would end successfully. Maybe i was not clear enough, thanks for your answer, sorry for the disturbance.

from ansible.

nitzmahone avatar nitzmahone commented on May 24, 2024

Inventory plugins are far more capable, flexible, and debuggable than inventory scripts in pretty much every way, so especially if you're writing in Python, I'd strongly suggest writing an inventory plugin instead of a script. They don't rely on stdout JSON dumping and have an actual API for interacting with Ansible.

That said, if you really need to debug a Python inventory script, I'd suggest using a debugger that supports debugging subprocesses (eg ipdb, pycharm/pydevd, VSCode). There are ways to get pdb to do that too, but it's a pain.

from ansible.

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.