oravirt / ansible-oracle-modules

Oracle modules for Ansible
MIT License
214 stars 160 forks source link

Python modules should have a .py extension #82

Open srgvg opened 6 years ago

srgvg commented 6 years ago

I'd recommend renaming the Python modules by adding the .py extension. Without them, they are not taken into account by the ansible-doc utiliy, and possibly other functionality might be missing when installing them on some library path.

Context, background and further explanation, see https://github.com/ansible/ansible/issues/48797

Thank you.

dsjagoda commented 5 years ago

Even when adding the .py extension to the oracle_db module, ansible-doc will still return an error on the oracle_db module. I did not test all modules after adding a .py extension to them but did verify that going through the same exercise below with oracle_role did work.

[djagoda@ansapdvl2 ~]$ ansible --version
ansible 2.7.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/djagoda/GITHUB-ansible_oracle_modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
[djagoda@ansapdvl2 ~]$ ls -l $ANSIBLE_LIBRARY/oracle_db
-rw-r--r--. 1 djagoda users 33271 Jan 23 14:29 /home/djagoda/GITHUB-ansible_oracle_modules/oracle_db
[djagoda@ansapdvl2 ~]$ ansible-doc -l |grep oracle_db
[djagoda@ansapdvl2 ~]$ mv $ANSIBLE_LIBRARY/oracle_db $ANSIBLE_LIBRARY/oracle_db.py
[djagoda@ansapdvl2 ~]$ ansible-doc -l |grep oracle_db
oracle_db                                            Manage an Oracle database                                                            
[djagoda@ansapdvl2 ~]$ ansible-doc -t module oracle_db
ERROR! module oracle_db has a documentation error formatting or is missing documentation.
[djagoda@ansapdvl2 ~]$ 
krilor commented 5 years ago

I did something like this:

# Install https://github.com/oravirt/ansible-oracle-modules
# Ensure directory
mkdir -p ~/.ansible/plugins/modules
#Download
wget https://github.com/oravirt/ansible-oracle-modules/archive/master.zip -O aom-tmp.zip
# Install
unzip  -j aom-tmp.zip -x *test-modules.yml *README.md *LICENSE -d ~/.ansible/plugins/modules
# Add python extention for ansible-doc
find ~/.ansible/plugins/modules -type f -name "oracle*" ! -name "*.*" -exec mv -f {} {}.py \;
# Set proper mod
find ~/.ansible/plugins/modules -type f -name "oracle*.py" -exec chmod 755 {} \;
# Cleanup
rm aom-tmp.zip

ansible-doc -t module oracle_db does not work, but ansible-doc -t module oracle_db does