question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

3.0 breaks connections using ansible

See original GitHub issue

I’m trying out version 3.0.1 with --connection=ansible and it breaks on ansible_runner. The same command works fine with 2.1.0:

pytest -vvv --connection=ansible --ansible-inventory=hosts test_remote.py 
collected 0 items / 1 errors                                                  

=================================== ERRORS ====================================
_______________________ ERROR collecting test_remote.py _______________________
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/pluggy/hooks.py:289: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/pluggy/manager.py:68: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/pluggy/manager.py:62: in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/_pytest/python.py:238: in pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/_pytest/python.py:414: in _genfunctions
    self.ihook.pytest_generate_tests(metafunc=metafunc)
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/pluggy/hooks.py:289: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/pluggy/manager.py:68: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/pluggy/manager.py:62: in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/testinfra/plugin.py:113: in pytest_generate_tests
    ansible_inventory=metafunc.config.option.ansible_inventory,
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/testinfra/host.py:143: in get_hosts
    for backend in testinfra.backend.get_backends(hosts, **kwargs):
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/testinfra/backend/__init__.py:91: in get_backends
    for name in klass.get_hosts(host, **kw):
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/testinfra/backend/ansible.py:59: in get_hosts
    return AnsibleRunner.get_runner(inventory).get_hosts(host)
../../../../.virtualenvs/ceph-volume/lib/python3.6/site-packages/testinfra/utils/ansible_runner.py:124: in get_hosts
    groupmatch = fnmatch.fnmatch(group, pattern)
../../../../.virtualenvs/ceph-volume/lib/python3.6/fnmatch.py:35: in fnmatch
    pat = os.path.normcase(pat)
../../../../.virtualenvs/ceph-volume/lib/python3.6/posixpath.py:54: in normcase
    s = os.fspath(s)
E   TypeError: expected str, bytes or os.PathLike object, not NoneType
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!

With 2.1.0 is fine:

pytest -vvv --connection=ansible --ansible-inventory=hosts test_remote.py
============================= test session starts =============================
platform linux2 -- Python 2.7.16, pytest-4.4.1, py-1.8.0, pluggy-0.10.0 -- /tmp/27/bin/python2
cachedir: .pytest_cache
rootdir: /home/alfredo/python/
plugins: testinfra-2.1.0
collected 2 items                                                             

test_remote.py::test_release_file[ansible://node2] PASSED               [ 50%]
test_remote.py::test_release_file[ansible://node3] PASSED               [100%]

The test file:

def test_release_file(host):
    release_file = host.file("/etc/os-release")
    assert release_file.contains('CentOS')
    assert release_file.contains('VERSION="7 (Core)"')

And the hosts file:

[nginx]
node2
node3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alfredodezacommented, May 7, 2019

3.0.2 works! Thank you so much

0reactions
philpepcommented, May 7, 2019

I just released 3.0.2 with these fixes, tell me if it works for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

3.0 breaks connections using ansible (part 2) #467 - GitHub
Version 3.0 (all from .0.0 to .0.5) breaks connections to ansible hosts behind a "jumphost or bastionhost". (#439 Doesn't fix it)
Read more >
Ansible 3.0.0 Q&A
Major releases of the Ansible community package can contain breaking changes in the modules and other plugins within the included Collections ...
Read more >
Known Issues — Ansible Tower Release Notes v3.2.7
This error is the result of Safari silently refusing to establish a connection to a web socket that is using a self-signed certificate....
Read more >
Ansible 6 Porting Guide
Since this potentially breaks existing playbooks, we will not change this behavior until community.routeros 3.0.0. Breaking Changes . community.general .
Read more >
Ansible 4 Porting Guide
Breaking Changes. Major Changes. Removed Features. Deprecated Features. We suggest you read this page along with the Ansible 4 Changelog to understand what ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found