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

restconf_get module displays output in wrong format #534

Open
prabhukg opened this issue Apr 6, 2023 · 0 comments
Open

restconf_get module displays output in wrong format #534

prabhukg opened this issue Apr 6, 2023 · 0 comments

Comments

@prabhukg
Copy link

prabhukg commented Apr 6, 2023

SUMMARY

restconf_get module displays xml output for json format and json output for the xml format.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

restconf_get

ANSIBLE VERSION
ansible [core 2.14.4]
  config file = /Users/pkomarap/Desktop/Ansible/ansible.cfg
  configured module search path = ['/Users/pkomarap/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/7.4.0/libexec/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/pkomarap/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.2 (main, Mar 24 2023, 00:31:37) [Clang 14.0.0 (clang-1400.0.29.202)] (/usr/local/Cellar/ansible/7.4.0/libexec/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

COLLECTION VERSION

# /usr/local/Cellar/ansible/7.4.0/libexec/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 4.1.0  

# /Users/pkomarap/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 5.0.0  

CONFIGURATION
CONFIG_FILE() = /Users/pkomarap/Desktop/Ansible/ansible.cfg
DEFAULT_LOG_PATH(env: ANSIBLE_LOG_PATH) = /Users/pkomarap/Desktop/Ansible/Logs/ansible_04042023_212034.log
DISPLAY_ARGS_TO_STDOUT(/Users/pkomarap/Desktop/Ansible/ansible.cfg) = True
OS / ENVIRONMENT

Target OS: IOS-XE

STEPS TO REPRODUCE

execute the below mentioned playbook on a IOS-XE device

- name: sample
  hosts: all
  gather_facts: no
  tasks:
    - name: rc_get
      ansible.netcommon.restconf_get:
        # Output can either be json or xml
        content: all
        output: 
        path: "/Cisco-IOS-XE-native:native/hostname"
      register: config_out
EXPECTED RESULTS
ACTUAL RESULTS
TASK [rc_get content=all, output=xml, path=/Cisco-IOS-XE-native:native/hostname] ********************************************
ok: [10.105.127.151]

TASK [debug var=config_out] *************************************************************************************************
ok: [10.105.127.151] => {
    "config_out": {
        "changed": false,
        "failed": false,
        "response": {
            "hostname": {
                "#text": "cmt-9300l-1",
                "@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XE-native",
                "@xmlns:ios": "http://cisco.com/ns/yang/Cisco-IOS-XE-native"
            }
        }
    }
}

TASK [rc_get content=all, output=xml, path=/Cisco-IOS-XE-native:native/hostname] ********************************************
ok: [10.105.127.151]

TASK [debug var=config_out] *************************************************************************************************
ok: [10.105.127.151] => {
    "config_out": {
        "changed": false,
        "failed": false,
        "response": {
            "hostname": {
                "#text": "cmt-9300l-1",
                "@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XE-native",
                "@xmlns:ios": "http://cisco.com/ns/yang/Cisco-IOS-XE-native"
            }
        }
    }
}
@Qalthos Qalthos changed the title restconf_getmodules displays output in wrong format restconf_get module displays output in wrong format Apr 12, 2023
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