oracle/oci-ansible-modules

subdirectory not created

Closed this issue · 2 comments

Issue Report

Describe the issue

File "install.py", line 167, in main os.mkdir(oracle_module_dir_path)

directory cloud/oracle does not exist;
os.mkdir fails if parent not exist

update install.py os.mkdir(oracle_module_dir_path)

163 ### Modules copy ###
164 oracle_module_dir_path = os.path.join(ansible_path, "modules", "cloud", "oracle")
165 if not os.path.exists(oracle_module_dir_path):
166 print("Creating directory {}".format(oracle_module_dir_path))
167 - #os.mkdir(oracle_module_dir_path)
167 + my_mkdir(oracle_module_dir_path)

185 + def my_mkdir(dir):
186 + try:
187 + os.makedirs(dir)
188 + except:
189 + pass
190 +

with the fix

...
Copying to $HOME/.local/lib/python3.6/site-packages/ansible/modules/cloud/oracle/oci_zone.py
Copying to $HOME/.local/lib/python3.6/site-packages/ansible/modules/cloud/oracle/oci_zone_facts.py
Copying to $HOME/.local/lib/python3.6/site-packages/ansible/modules/cloud/oracle/oci_zone_records.py
Copying to $HOME/.local/lib/python3.6/site-packages/ansible/modules/cloud/oracle/oci_zone_records_facts.py
OCI Ansible modules installed successfully.

A clear and concise description of what the issue is.

Expected behavior

A clear and concise description of what you expected to happen.

Environment

  • OS version:
    $ uname -a Linux NB-2619 4.4.0-18362-Microsoft #1049-Microsoft Thu Aug 14 12:01:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux

  • Ansible version:

    insert output of ansible --version here
    $ ansible --version
    ansible 2.10.3
    config file = /etc/ansible/ansible.cfg
    configured module search path = ['/home/sumario/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
    ansible python module location = /home/sumario/.local/lib/python3.7/site-packages/ansible
    executable location = /home/sumario/.local/bin/ansible
    python version = 3.7.5 (default, Nov 7 2019, 10:50:52) [GCC 8.3.0]

  • OCI Python SDK version:

    insert output of python -c "import oci;print(oci.__version__)" here

    2.24.0

  • OCI Ansible Modules version:

    insert output of python -c "from ansible.module_utils.oracle import oci_utils; print(oci_utils.__version__)" here

    1.19.0

Ansible playbook to reproduce the issue

insert a sample playbook to reproduce the issue here(if relevant to the issue)

@marionolte Yes the legacy modules don't work well with ansible>=2.10. Also these modules are deprecated. Please use the new collections modules https://github.com/oracle/oci-ansible-collection. The migration guide (https://github.com/oracle/oci-ansible-collection/blob/master/MigrationGuide.md) would help in moving from legacy modules to new collection.

The legacy OCI Ansible modules have been deprecated in favor of the new OCI Ansible collection. These are no longer supported and there will be no further updates or fixes. Please migrate to the OCI Ansible collection for improved features and continued support. Refer to the Migration Guide for best practices.