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

os10_facts throws exception #109

Open
cultcom opened this issue Dec 13, 2021 · 13 comments
Open

os10_facts throws exception #109

cultcom opened this issue Dec 13, 2021 · 13 comments

Comments

@cultcom
Copy link

cultcom commented Dec 13, 2021

SUMMARY

I try to run os10_facts against a S5232F Switch and always get a lxml exception:

TASK [dellemc.os10.os10_facts] ********************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: lxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1
fatal: [core-spine-d]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/.ansible/tmp/ansible-local-2822487naa90uxh/ansible-tmp-1639061214.1453056-2822630-159388307198021/AnsiballZ_os10_facts.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/tmp/.ansible/tmp/ansible-local-2822487naa90uxh/ansible-tmp-1639061214.1453056-2822630-159388307198021/AnsiballZ_os10_facts.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/tmp/.ansible/tmp/ansible-local-2822487naa90uxh/ansible-tmp-1639061214.1453056-2822630-159388307198021/AnsiballZ_os10_facts.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.dellemc.os10.plugins.modules.os10_facts', init_globals=dict(_module_fqn='ansible_collections.dellemc.os10.plugins.modules.os10_facts', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_dellemc.os10.os10_facts_payload_k292z_9h/ansible_dellemc.os10.os10_facts_payload.zip/ansible_collections/dellemc/os10/plugins/modules/os10_facts.py\", line 505, in <module>\n  File \"/tmp/ansible_dellemc.os10.os10_facts_payload_k292z_9h/ansible_dellemc.os10.os10_facts_payload.zip/ansible_collections/dellemc/os10/plugins/modules/os10_facts.py\", line 490, in main\n  File \"/tmp/ansible_dellemc.os10.os10_facts_payload_k292z_9h/ansible_dellemc.os10.os10_facts_payload.zip/ansible_collections/dellemc/os10/plugins/modules/os10_facts.py\", line 302, in populate\n  File \"src/lxml/etree.pyx\", line 3237, in lxml.etree.fromstring\n  File \"src/lxml/parser.pxi\", line 1876, in lxml.etree._parseMemoryDocument\n  File \"src/lxml/parser.pxi\", line 1764, in lxml.etree._parseDoc\n  File \"src/lxml/parser.pxi\", line 1127, in lxml.etree._BaseParser._parseDoc\n  File \"src/lxml/parser.pxi\", line 601, in lxml.etree._ParserContext._handleParseResultDoc\n  File \"src/lxml/parser.pxi\", line 711, in lxml.etree._handleParseResult\n  File \"src/lxml/parser.pxi\", line 640, in lxml.etree._raiseParseError\n  File \"<string>\", line 1\nlxml.etree.XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

os10_facts

ANSIBLE VERSION
ansible [core 2.12.0]
  config file = /tmp/workdir/playbooks/dell-OS10/ansible.cfg
  configured module search path = ['/tmp/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /tmp/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /tmp/.ansible/collections:/usr/share/ansible/collections
  executable location = /tmp/.local/bin/ansible
  python version = 3.8.10 (default, Jun  2 2021, 10:49:15) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True
COLLECTION VERSION
Collection   Version
------------ -------
dellemc.os10 1.1.1  

CONFIGURATION
ANSIBLE_NOCOWS(/tmp/workdir/playbooks/dell-OS10/ansible.cfg) = True

OS / ENVIRONMENT
Dell EMC Networking OS10 Enterprise
Copyright (c) 1999-2021 by Dell Inc. All Rights Reserved.
OS Version: 10.5.2.7
Build Version: 10.5.2.7.374
Build Time: 2021-07-28T04:48:16+0000
System Type: S5232F-ON
Architecture: x86_64
Up Time: 13 weeks 3 days 12:50:59
STEPS TO REPRODUCE
---

- hosts:
    - spine
    - leaf
  gather_facts: False

  tasks:

    - dellemc.os10.os10_facts:
        gather_subset: all
      register: facts

    - debug:
        msg: "{{ facts }}"
EXPECTED RESULTS

I expect to get an dictionary with facts about the switch.

ACTUAL RESULTS

I get the exception as quoted above.

@prasadapr
Copy link
Collaborator

The "lxml exception" you are getting only on S5232F Switch or even on other switches also facing the same issue?
Possible pls can you share your inventory file.

@prasadapr
Copy link
Collaborator

possible can you share ansible.cfg file :
cat /etc/ansible/ansible.cfg

@cultcom
Copy link
Author

cultcom commented Dec 16, 2021

ansible is installed locally with "pip" so I have no /etc/ansible/ansible.cfg and everything is default.

I get the error on the other S5000 series switches as well. All I found so far is an issue with Py3 but Py2 is no longer supported by ansible.

@prasadapr
Copy link
Collaborator

I think the problem is with some environmental issue or may be configuration.

@cultcom
Copy link
Author

cultcom commented Dec 23, 2021

Any idea then where to start debugging?

@prasadapr
Copy link
Collaborator

I tried to reproduce the issue on same platform (S5232F-ON & S5248F-ON) with same Image and same version of ansible, python and Collection.
Its working fine for me, without any Issues.

Find the enclosed details for the same:

show version
Dell EMC Networking OS10 Enterprise
Copyright (c) 1999-2021 by Dell Inc. All Rights Reserved.
OS Version: 10.5.2.7
Build Version: 10.5.2.7.374
Build Time: 2021-07-28T04:48:16+0000
System Type: S5232F-ON
Architecture: x86_64
Up Time: 00:10:17

playbook:

  • hosts: datacenter
    gather_facts: False
    connection: network_cli

    tasks:

    • dellemc.os10.os10_facts:
      gather_subset: all
      register: facts

    • debug:
      msg: "{{ facts }}"

ansible --version
ansible [core 2.12.0]
config file = None
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
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
jinja version = 2.10.1
libyaml = True

python3 --version
Python 3.8.10

ansible-galaxy collection list dellemc.os10
Collection Version


dellemc.os10 1.1.1

provided few lines of ansible execution log

ansible-playbook -i inventory.yaml os10_ansible_facts_109.yaml

PLAY [datacenter] *********************************************************************************************************************************************************************************************************************
[WARNING]: Collection ansible.netcommon does not support Ansible version 2.12.0

TASK [dellemc.os10.os10_facts] ********************************************************************************************************************************************************************************************************
ok: [spine]

TASK [debug] **************************************************************************************************************************************************************************************************************************
ok: [spine] => {
"msg": {
"ansible_facts": {

        },
        "ansible_net_servicetag": "1RLD9Z2",
        "ansible_net_version": "10.5.2.7"
    },
    "changed": false,
    "failed": false
}

}

PLAY RECAP ****************************************************************************************************************************************************************************************************************************
spine : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

@prasadapr
Copy link
Collaborator

possible can we have live session to debug.

@cultcom
Copy link
Author

cultcom commented Dec 23, 2021

nice idea but my time is running out today. I am back in office the January 5th. You may contact me over IRC (eJunky), I am currently hanging in #ansible-network channel.

@cultcom
Copy link
Author

cultcom commented Jan 5, 2022

Starting all over again I managed to get things running with hard coded passwords. So my problem starts using "ssh_type=libssh" which I really want to use to utilize my ".ssh/config" and the corresponding private keys.

Any ideas why this is happening?

@timway
Copy link

timway commented Jun 8, 2022

@prasadapr and @cultcom I just encountered this issue with the collection. I hit it because ansible.netcommon >= 3.0.0 has switched to ssh_type=libssh by default (changelog for reference).

If you are using ansible.netcommon >= 3.0.0 then you need to configure ssh_type to use paramiko. I'd like to be able to use libssh in the future as it is becoming the standard and with it we get the potential for more security guarantees (blog for reference).

@Eddgar0
Copy link

Eddgar0 commented Jun 7, 2023

@prasadapr and @cultcom I just encountered this issue with the collection. I hit it because ansible.netcommon >= 3.0.0 has switched to ssh_type=libssh by default (changelog for reference).

If you are using ansible.netcommon >= 3.0.0 then you need to configure ssh_type to use paramiko. I'd like to be able to use libssh in the future as it is becoming the standard and with it we get the potential for more security guarantees (blog for reference).

I have same problem and I changed the ssh connection to use paramiko at the hostvar level by using ansible_network_cli_ssh_type: paramiko , so other connections can use libssh that is better for reason mentioned.

hostname: DSED101
ansible_ssh_user: mrmime
ansible_network_os: dellemc.os10.os10
ansible_network_cli_ssh_type: paramiko

@lucastobey
Copy link

lucastobey commented Feb 26, 2024

@prasadapr This needs attention now that ansible.netcommon in this collection v1.2.4 defaults to ansible-pylibssh We have also ran into this issue making us force the use of paramiko over ansible-pylibssh.
Related: #147

ansible==8.1.0
ansible-core==2.15.8
ansible-pylibssh==1.1.0
bcrypt==4.1.2
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
cryptography==41.0.7
dnspython==2.4.2
future==0.18.3
idna==3.6
Jinja2==3.1.3
jmespath==1.0.1
lxml==5.1.0
MarkupSafe==2.1.3
netaddr==0.10.1
packaging==23.2
paramiko==3.4.0
pathspec==0.12.1
pycparser==2.21
PyNaCl==1.5.0
pynetbox==7.0.1
pytz==2023.3.post1
PyYAML==6.0.1
requests==2.31.0
resolvelib==1.0.1
six==1.16.0
textfsm==1.1.3
urllib3==2.1.0
xmltodict==0.13.0
yamllint==1.33.0

@prasadapr
Copy link
Collaborator

Hi @lucastobey, @timway , @cultcom and @Eddgar0, Thanks for all your observations and comments.

Will check and update on this.

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

5 participants