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

commscope.icx.icx_config NOT saving backup file #45

Open
amosolson opened this issue Dec 31, 2021 · 1 comment
Open

commscope.icx.icx_config NOT saving backup file #45

amosolson opened this issue Dec 31, 2021 · 1 comment

Comments

@amosolson
Copy link

When setting backup=yes in the icx_config module, the backup file is not created.

Also, the documentation for the module says that the result will include a backup_path string. Instead, a variable called __backup__ is returned which includes the entire text of the switch config.

This appears identical to the following icx bug report on the ansible community git:
ansible-collections/community.network#260

Expected behavior:

  • Backup file is written to disk
  • Module result includes backup_path variable showing where the file was saved

Actual Behavior:

  • No file is written to disk
  • backup_path variable is not returned
  • Entire switch config is returned in an undocumented __backup__ variable

Playbook to replicate issue

- hosts: 10.0.0.1 << your ICX switch
  vars:
    ansible_network_os: commscope.icx.icx
    ansible_user: ...
    ansible_password:  ...
    ansible_become: yes
    ansible_become_method: enable
    ansible_become_password: ...
  tasks:
    - name: Save Ruckus config
      commscope.icx.icx_config:
        backup: yes
      register: result_var

    - debug:
        var: result_var

Result

ok: [10.0.0.1] => {
    "result_var": {
        "__backup__": "Current configuration:\n!\nver 08.0.90dT213\n!\nstack unit 1\n  module 1 icx7150-24p-poe-port-management-module\n  module 2 icx7150-2-copper-port-2g-module\n  module 3 icx7150-4-sfp-plus-port-40g-module\n  priority 128\n  stack-port 1/3/1\n  stack-port 1/3/3\nstack unit 2\n  module 1 icx7150-24p-poe-port-management-module\n  module 2 icx7150-2-copper-port-2g-module\n [etc, entire config is included in the variable] ip address 10.0.0.125 255.255.255.0\n!\ninterface ve 1611\n ip address 10.16.1.1 255.255.255.0\n ip helper-address 1 10.0.0.159\n!\n!\n!\n!\n!\n!\n!\nip ssh  timeout 30\nip ssh  idle-time 20\n!\n!\n!\n!\n!\nend",
        "changed": false, 
        "failed": false
    }
}

The backup file is not created, and the actual config is returned raw in the result variable from the module.

@amosolson
Copy link
Author

Browsing the Ansible codebase, it looks like the following ActionModule is supposed to save the __backup__ variable to disk and create the backup_path variable:

network.py

I'd guess either this ActionModule isn't being invoked, or the icx_config module is failing the conditions at line 98:

if (
 config_module
 and self._task.args.get("backup")
 and not result.get("failed")
):
 self._handle_backup_option(result, task_vars)

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

1 participant