At 2014-05-25 12:21:05 +0100, [email protected] wrote: > > A few of them just proxy through to unix commands while others will > use a Python API when it exists. Can someone explain the advantages > and disadvantages for both?
I don't have a general answer, but I can illustrate one such difference by something I ran into months ago. I had a list of Debian package names, and I wanted to figure out which packages in that list were not already installed; or, alternatively, to find out if they were all up-to-date or not. This turns out to be clumsy and slow to do using apt-get on the command line. In contrast, with just a few lines of Python, I could use an apt.Cache() to check cache[name].is_installed and cache[name].installed.version for all my packages in a loop. It worked great. > I'm writing a few modules and don't want to feel bad for writing a > command proxy when I could spend time writing a python API for my > needs. My advice, for what it's worth, would be to do as much as you can by running commands, and write more code only if a clear need presents itself. (Oh, also: don't feel bad.) -- ams -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20140525115633.GG17698%40toroid.org. For more options, visit https://groups.google.com/d/optout.
