Hello, this is my first post to the ansible community.
I'm a newby to Ansible, but a very experienced python developer.
Anyway, after installing the latest Ansible 2.2.2.0, I tried out a simple
module call to verify if a RPM package existed on some RHEL 6/7 systems.
Anyway, the module failed, with the error:
"cannot find /usr/bin/apt-get and/or /usr/bin/rpm"
My first curiosity was to figure out what python module they used to
execute "rpm" or "apt-get", and see what path it used (if any) and how to
correct. Somebody else had a similar problem, and the answers coming
back were focusing on the user's PATH or SUDO configuration, but there was
never a resolution.
(That post is here -->
https://groups.google.com/forum/#!searchin/ansible-project/executable$20not$20found%7Csort:relevance/ansible-project/zl6l6i0bBMc/vFCNiEYq3-IJ
Anyway, I , decided to take a look at "apt_rpm.py" directly, and lo and
behold, I think I found the problem. In the very beginning of the
"main()" function, the author tries determine if either "apt-get" or "rpm"
are available...and if so continue on, or FAIL if not. Makes sense?
However, way the if conditional was written is kind of confusing, and I
believe it exits with a FAIL if only the 'apt-get' is missing, which I
encounter on a RHEL system. To make a long story short, I rewrote the if
conditional to be a little clearer, and IT WORKS!.
Here's what I did:
Replace:
153 if not os.path.exists(APT_PATH) or not os.path.exists(RPM_PATH):
154 module.fail_json(msg="cannot find /usr/bin/apt-get and/or
/usr/bin/rpm")
With...
153 if (os.path.exists(APT_PATH) or os.path.exists(RPM_PATH)):
154 pass
155 else:
156 module.fail_json(msg="cannot find /usr/bin/apt-get and/or
/usr/bin/rpm")
I believe this bug has existed from v1.5, and kind of surprised it hasn't
been found.
Let me know how I can either:
1. Who or how should I get this to an existing Ansible developer to look
at?
2. Please direct me to how I can become an ansible developer and start
writing high-quality code to help you'alls out. :-)
Thank You
Peter
--
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/710638aa-2c2a-49eb-b976-f5adf2379624%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.