Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: os10_config not respecting dir_path or filename #102

Closed
tstrupp opened this issue Sep 29, 2021 · 11 comments
Closed

BUG: os10_config not respecting dir_path or filename #102

tstrupp opened this issue Sep 29, 2021 · 11 comments

Comments

@tstrupp
Copy link

tstrupp commented Sep 29, 2021

# EXAMPLE PLAYBOOK
---
- name: Pull Config Files
  hosts: localhost
  vars:
    provider:
      host: 1.1.1.1
      username: ~
      password: ~
  tasks:
    - name: os10 backup
      dellemc.o10.os10_config:
        provider: "{{ provider }}"
        backup: yes
        backup_options:
          dir_path: /Users/testing

Expected result is to save the file under "/users/testing" however the job creates a "backup" folder and dumps the filename in there. OS9_config module works fine and respects directory_path and filename appropriately.

os9:

candidate = get_candidate(module)

if module.params['backup']:
    if not module.check_mode:
        result['__backup__'] = get_config(module)
commands = list()

os10:

if module.params['backup']:
    if not module.check_mode:
        result['__backup__'] = get_config(module)

commands = list()
candidate = get_candidate(module)
@zerwes
Copy link

zerwes commented Feb 2, 2022

see #113 : it seems the config is not saved at all

@prasadapr
Copy link
Collaborator

As mentioned by @zerwes the issue is similar/dup of issue#113 or vice versa.

@tstrupp, yes as per the expected result, its save the file under "/users/testing" and its working as per the expected.
Already provided all the details and execution logs part of issue#113.

Find all the details again for this issue#102, for reference:

root@UBUNTU18-VM-38-024:~/os10_collections# cat os10_config_backup_Issue-102.yaml

---
- name: Pull Config Files
  hosts: spine3
  gather_facts: false
  connection: network_cli
  collections:
   - dellemc.os10

  vars:
   provider:
     host: 1.1.1.1
     username: ~
     password: ~

  tasks:
   - name: os10 backup
     os10_config:
       provider: "{{ provider }}"
       backup: yes
       backup_options:
         dir_path: /Users/testing

@prasadapr
Copy link
Collaborator

Execution Log:

root@UBUNTU18-VM-38-024:~/os10_collections# ansible-playbook -i inventory.yaml  os10_config_backup_Issue-102.yaml  -vvv
ansible-playbook 2.9.26
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /root/os10_collections/inventory.yaml as it did not pass its verify_file() method
script declined parsing /root/os10_collections/inventory.yaml as it did not pass its verify_file() method
Parsed /root/os10_collections/inventory.yaml inventory source with ini plugin
Skipping callback 'actionable', as we already have a stdout callback.
Skipping callback 'counter_enabled', as we already have a stdout callback.
Skipping callback 'debug', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'full_skip', as we already have a stdout callback.
Skipping callback 'json', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'null', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Skipping callback 'selective', as we already have a stdout callback.
Skipping callback 'skippy', as we already have a stdout callback.
Skipping callback 'stderr', as we already have a stdout callback.
Skipping callback 'unixy', as we already have a stdout callback.
Skipping callback 'yaml', as we already have a stdout callback.

PLAYBOOK: os10_config_backup_Issue-102.yaml *************************************************************************************************************************************************************************************
1 plays in os10_config_backup_Issue-102.yaml

PLAY [Pull Config Files] ********************************************************************************************************************************************************************************************************
META: ran handlers

TASK [os10 backup] **************************************************************************************************************************************************************************************************************
task path: /root/os10_collections/os10_config_backup_Issue-102.yaml:17
Tuesday 08 February 2022  14:55:42 +0530 (0:00:00.073)       0:00:00.073 ******
[WARNING]: provider is unnecessary when using network_cli and will be ignored
<100.104.40.188> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-10492DCsspu `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312349.79-10499-55874773767254 `" && echo ansible-tmp-1644312349.79-10499-55874773767254="` echo /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312349.79-10499-55874773767254 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-10492DCsspu/tmp5TXeiH TO /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312349.79-10499-55874773767254/AnsiballZ_os10_config.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312349.79-10499-55874773767254/ /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312349.79-10499-55874773767254/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312349.79-10499-55874773767254/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312349.79-10499-55874773767254/ > /dev/null 2>&1 && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-10492DCsspu `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628 `" && echo ansible-tmp-1644312356.73-10499-113004259800628="` echo /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628 `" ) && sleep 0'
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/files/stat.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-10492DCsspu/tmpJnQWqm TO /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/AnsiballZ_stat.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/ /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/AnsiballZ_stat.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/AnsiballZ_stat.py && sleep 0'
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-10492DCsspu/tmpK2kTtF TO /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/source
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/ /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/source && sleep 0'
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/files/copy.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-10492DCsspu/tmpqx9pO8 TO /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/AnsiballZ_copy.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/ /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/AnsiballZ_copy.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/AnsiballZ_copy.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-10492DCsspu/ansible-tmp-1644312356.73-10499-113004259800628/ > /dev/null 2>&1 && sleep 0'
changed: [spine3] => {
    "backup_path": "/Users/testing/spine3_config.2022-02-08@14:55:56",
    "changed": true,
    "date": "2022-02-08",
    "filename": "spine3_config.2022-02-08@14:55:56",
    "invocation": {
        "module_args": {
            "after": null,
            "backup": true,
            "backup_options": {
                "dir_path": "/Users/testing",
                "filename": null
            },
            "before": null,
            "config": null,
            "lines": null,
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": null,
            "update": "merge"
        }
    },
    "saved": false,
    "shortname": "/Users/testing/spine3_config",
    "time": "14:55:56"
}
META: ran handlers
META: ran handlers

PLAY RECAP **********************************************************************************************************************************************************************************************************************
spine3                     : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Tuesday 08 February 2022  14:56:00 +0530 (0:00:17.439)       0:00:17.512 ******
===============================================================================
os10 backup ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 17.44s
/root/os10_collections/os10_config_backup_Issue-102.yaml:17 --------------------------------------------------------------------------------------------------------------------------------------------------------------------
root@UBUNTU18-VM-38-024:~/os10_collections#


Backupfile:

root@UBUNTU18-VM-38-024:/# ls Users/testing/spine3_config.2022-02-08@14\:55\:56
Users/testing/spine3_config.2022-02-08@14:55:56
root@UBUNTU18-VM-38-024:/#  

@prasadapr
Copy link
Collaborator

Sure @zerwes, will look in to the Issue#114 and will provide the observations and required action will be taken care.

Anyhow Issue#114 is opened for tracking. 
@zerwes, if you are OK, shall we close this issue#102.

@prasadapr
Copy link
Collaborator

@zerwes, shall we close this issue#102.

@zerwes
Copy link

zerwes commented Feb 13, 2022

Hello @prasadapr
As it is not opened by me, I can not just say "yes, go ahead".
But AFAIS you are right and the topic is discussed sufficiently in #113 and #114 is there to fix in order to avoid further confusions.
So if @tstrupp has no objections in the next days, I think it would be OK to close it.

@prasadapr
Copy link
Collaborator

Thanks @zerwes for the update and its correct what your are saying. Sure i will check with @tstrupp.

@prasadapr
Copy link
Collaborator

Hi @tstrupp,
This is similar to issue#113 and we have provided all the details and logs.
And part if this Issue#102 also we have provided all the details and its working fine.

@tstrupp, if you are OK, shall we close this issue#102.

@prasadapr
Copy link
Collaborator

Hi @tstrupp, if you are OK, shall we close this issue#102.

@tstrupp
Copy link
Author

tstrupp commented Feb 17, 2022

Yes, will close

@tstrupp tstrupp closed this as completed Feb 17, 2022
@prasadapr
Copy link
Collaborator

Thanks a lot @tstrupp for the confirmation, so i am closing this issue#102.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants