community.network icon indicating copy to clipboard operation
community.network copied to clipboard

An error is reported when the ce_mlag_interface module is used.

Open gemingqi opened this issue 2 years ago • 2 comments

SUMMARY

The following error is reported when the ce_mlag_interface module is used: "msg": "Error: b'\r\n<CE6881_60.36><filter type="subtree">\r\n ^\r\nError: Unrecognized command found at \'^\' position.\r\n<CE6881_60.36>\r\n<CE6881_60.36>'"

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.network.ce_mlag_interface

ANSIBLE VERSION

ansible [core 2.12.0rc1]


##### COLLECTION VERSION
V3.0.0

##### CONFIGURATION
NA
OS / ENVIRONMENT

ubuntu 18.04

STEPS TO REPRODUCE
  • name: Mlag interface module test hosts: host3 connection: local gather_facts: no vars: cli: host: "120.108.60.36" port: "22" username: "huawei" password: "huaweiDC" transport: cli

    tasks:

    • name: Set interface mlag error down community.network.ce_mlag_interface: interface: 10GE1/0/23 mlag_error_down: enable provider: "{{ cli }}"



##### EXPECTED RESULTS
run without error

##### ACTUAL RESULTS
root@Virtual-Machine:/home/gemingqi/Documents/test# ansible-playbook mlag_test.yml -vvv
ansible-playbook [core 2.12.0rc1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible_core-2.12.0rc1-py3.8.egg/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.8.0 (default, Feb 25 2021, 22:10:10) [GCC 8.4.0]
  jinja version = 3.0.2
  libyaml = False
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
[WARNING]: Skipping plugin (/usr/local/lib/python3.8/dist-
packages/ansible_core-2.12.0rc1-py3.8.egg/ansible/plugins/connection/winrm.py) as it seems to be invalid: invalid
syntax (spawnbase.py, line 224)
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: mlag_test.yml ***********************************************************************************************
1 plays in mlag_test.yml

PLAY [Mlag interface module test] *************************************************************************************
META: ran handlers

TASK [Set interface mlag error down] **********************************************************************************
task path: /home/gemingqi/Documents/test/mlag_test.yml:14
<120.108.60.36> using connection plugin network_cli (was local)
redirecting (type: connection) ansible.builtin.persistent to ansible.netcommon.persistent
[DEPRECATION WARNING]: connection local support for this module is deprecated use either 'network_cli' or 
'ansible.netcommon.network_cli' connection. This feature will be removed from community.network in version 4.0.0. 
Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
<120.108.60.36> ESTABLISH LOCAL CONNECTION FOR USER: root
<120.108.60.36> EXEC /bin/sh -c 'echo ~root && sleep 0'
<120.108.60.36> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1636076260.874958-27791-93870602061578 `" && echo ansible-tmp-1636076260.874958-27791-93870602061578="` echo /root/.ansible/tmp/ansible-tmp-1636076260.874958-27791-93870602061578 `" ) && sleep 0'
<host3> Attempting python interpreter discovery
<120.108.60.36> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<120.108.60.36> EXEC /bin/sh -c '/usr/bin/python3.8 && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/community/network/plugins/modules/ce_mlag_interface.py
<120.108.60.36> PUT /root/.ansible/tmp/ansible-local-27785_x86_khe/tmpko6bjcoe TO /root/.ansible/tmp/ansible-tmp-1636076260.874958-27791-93870602061578/AnsiballZ_ce_mlag_interface.py
<120.108.60.36> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1636076260.874958-27791-93870602061578/ /root/.ansible/tmp/ansible-tmp-1636076260.874958-27791-93870602061578/AnsiballZ_ce_mlag_interface.py && sleep 0'
<120.108.60.36> EXEC /bin/sh -c '/usr/bin/python3.8 /root/.ansible/tmp/ansible-tmp-1636076260.874958-27791-93870602061578/AnsiballZ_ce_mlag_interface.py && sleep 0'
<120.108.60.36> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1636076260.874958-27791-93870602061578/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_community.network.ce_mlag_interface_payload_3bkc0xv8/ansible_community.network.ce_mlag_interface_payload.zip/ansible_collections/community/network/plugins/module_utils/network/cloudengine/ce.py", line 380, in get_nc_config
    response = conn.get(xml_str)
  File "/tmp/ansible_community.network.ce_mlag_interface_payload_3bkc0xv8/ansible_community.network.ce_mlag_interface_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 80, in __rpc__
    return self.parse_rpc_error(
  File "/tmp/ansible_community.network.ce_mlag_interface_payload_3bkc0xv8/ansible_community.network.ce_mlag_interface_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/netconf.py", line 126, in parse_rpc_error
    raise ConnectionError(rpc_error)
[WARNING]: Distribution ubuntu 18.04 on host host3 should use /usr/bin/python3, but is using /usr/bin/python3.8, since
the discovered platform python interpreter was not present. See https://docs.ansible.com/ansible-
core/2.12/reference_appendices/interpreter_discovery.html for more information.
fatal: [host3]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.8"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "provider": {
                "host": "120.108.60.36",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": 22,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "cli",
                "use_ssl": null,
                "username": "huawei",
                "validate_certs": null
            },
            "transport": "cli"
        }
    },
    "msg": "Error: b'\\r\\n<CE6881_60.36><filter type=\"subtree\">\\r\\n              ^\\r\\nError: Unrecognized command found at \\'^\\' position.\\r\\n<CE6881_60.36>\\r\\n<CE6881_60.36>'"
}

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

gemingqi avatar Nov 05 '21 02:11 gemingqi

It appears that the NETCONF connection is not connected and the content of the Shema packet is directly executed on the device.However, the ce_mlag_config module has the same code flow and can be used normally.

gemingqi avatar Nov 05 '21 02:11 gemingqi

cc @QijunPan @TommyLike @edisonxiang @freesky-edward @hwDCN @niuzhenguo @xuxiaowei0512 @yanzhangi @zengchen1024 @zhongjun2 click here for bot help

ansibullbot avatar Jan 17 '22 21:01 ansibullbot