Hello community, here is the log from the commit of package python-testinfra for openSUSE:Factory checked in at 2018-07-22 23:04:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-testinfra (Old) and /work/SRC/openSUSE:Factory/.python-testinfra.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-testinfra" Sun Jul 22 23:04:12 2018 rev:3 rq:624200 version:1.14.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-testinfra/python-testinfra.changes 2018-05-02 12:19:16.914298629 +0200 +++ /work/SRC/openSUSE:Factory/.python-testinfra.new/python-testinfra.changes 2018-07-22 23:04:15.136930246 +0200 @@ -1,0 +2,19 @@ +Thu Jul 19 19:57:27 UTC 2018 - [email protected] + +- Update to v1.14.0 + + Add a new lxc backend + + Socket: fix is_listening for unix sockets + + Add namespace and container support for kubernetes backend + + Add a cache of parsed ansible inventories for ansible backend + + Service: fix service detection on Centos 6 hosts + + File: implement file comparison with string paths +- Update to v1.13.1 + + package: fix is_installed and version behavior for uninstalled + packages + + ansible: Use predictibles test ordering when using pytest-xdist + to fix random test collections errors +- Update to v1.13.0 + + socket: fix detection of udp listening sockets + + ssh backend: Add support for GSSAPI + +------------------------------------------------------------------- Old: ---- testinfra-1.12.0.tar.gz New: ---- testinfra-1.14.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-testinfra.spec ++++++ --- /var/tmp/diff_new_pack.qqlf3H/_old 2018-07-22 23:04:17.560929348 +0200 +++ /var/tmp/diff_new_pack.qqlf3H/_new 2018-07-22 23:04:17.564929346 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-testinfra -Version: 1.12.0 +Version: 1.14.0 Release: 0 Summary: Test infrastructures License: Apache-2.0 @@ -66,7 +66,8 @@ %files %{python_files} %defattr(-,root,root,-) -%doc CHANGELOG.rst LICENSE README.rst +%doc CHANGELOG.rst README.rst +%license LICENSE %python_alternative %{_bindir}/testinfra %{python_sitelib}/* ++++++ testinfra-1.12.0.tar.gz -> testinfra-1.14.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/CHANGELOG.rst new/testinfra-1.14.0/CHANGELOG.rst --- old/testinfra-1.12.0/CHANGELOG.rst 2018-04-24 21:20:54.000000000 +0200 +++ new/testinfra-1.14.0/CHANGELOG.rst 2018-06-05 15:00:19.000000000 +0200 @@ -2,6 +2,28 @@ Changelog ========= +1.14.0 +====== + +* Add a new lxc backend +* Socket: fix is_listening for unix sockets +* Add namespace and container support for kubernetes backend +* Add a cache of parsed ansible inventories for ansible backend +* Service: fix service detection on Centos 6 hosts +* File: implement file comparison with string paths + +1.13.1 +====== + +* package: fix is_installed and version behavior for uninstalled packages (#321 and #326) +* ansible: Use predictibles test ordering when using pytest-xdist to fix random test collections errors (#316) + +1.13.0 +====== + +* socket: fix detection of udp listening sockets (#311) +* ssh backend: Add support for GSSAPI + 1.12.0 ====== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/PKG-INFO new/testinfra-1.14.0/PKG-INFO --- old/testinfra-1.12.0/PKG-INFO 2018-04-24 21:21:47.000000000 +0200 +++ new/testinfra-1.14.0/PKG-INFO 2018-06-05 15:01:12.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: testinfra -Version: 1.12.0 +Version: 1.14.0 Summary: Test infrastructures Home-page: http://github.com/philpep/testinfra Author: Philippe Pepiot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/doc/source/backends.rst new/testinfra-1.14.0/doc/source/backends.rst --- old/testinfra-1.12.0/doc/source/backends.rst 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/doc/source/backends.rst 2018-06-05 14:56:29.000000000 +0200 @@ -91,10 +91,15 @@ kubectl ~~~~~~~ -The kubectl backend can be used to test containers running in Kubernetes. -It uses the `kubectl exec <http://kubernetes.io/docs/user-guide/kubectl/kubectl_exec/>`_ command:: - - $ py.test --connection=kubectl --hosts=pod_id-123456789-9fng/container_name +The kubectl backend can be used to test containers running in Kubernetes. It +uses the `kubectl exec <http://kubernetes.io/docs/user-guide/kubectl/kubectl_exec/>`_ command and +support connecting to a given container name within a pod and using a given +namespace:: + + # will use the default namespace and default container + $ py.test --hosts='kubectl://mypod-a1b2c3' + # specify container name and namespace + $ py.test --hosts='kubectl://somepod-2536ab?container=nginx&namespace=web' winrm @@ -104,3 +109,11 @@ $ py.test --hosts='winrm://Administrator:[email protected]' $ py.test --connection=winrm --hosts='[email protected]:2200?no_ssl=true&no_verify_ssl=true' + +LXC +~~~ + +The LXC backend can be used to test *running* LXC containers. It uses the +`lxc exec <https://linuxcontainers.org/lxd/getting-started-cli/>`_ command:: + + $ testinfra --hosts='lxc://container_name' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/images/centos_6/Dockerfile new/testinfra-1.14.0/images/centos_6/Dockerfile --- old/testinfra-1.12.0/images/centos_6/Dockerfile 1970-01-01 01:00:00.000000000 +0100 +++ new/testinfra-1.14.0/images/centos_6/Dockerfile 2018-06-04 13:29:42.000000000 +0200 @@ -0,0 +1,17 @@ +FROM centos:6 + +RUN yum clean all && \ + yum -y install \ + openssh-server && \ + rm -f /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_rsa_key && \ + ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_ecdsa_key && \ + ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && \ + sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config && \ + chkconfig sshd on && \ + service sshd start && \ + mkdir -p /root/.ssh && \ + echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgDryK4AjJeifuc2N54St13KMNlnGLAtibQSMmvSyrhH7XJ1atnBo1HrJhGZNNBVKM67+zYNc9J3fg3qI1g63vSQAA+nXMsDYwu4BPwupakpwJELcGZJxsUGzjGVotVpqPIX5nW8NBGvkVuObI4UELOleq5mQMTGerJO64KkSVi20FDwPJn3q8GG2zk3pESiDA5ShEyFhYC8vOLfSSYD0LYmShAVGCLEgiNb+OXQL6ZRvzqfFEzL0QvaI/l3mb6b0VFPAO4QWOL0xj3cWzOZXOqht3V85CZvSk8ISdNgwCjXLZsPeaYL/toHNvBF30VMrDZ7w4SDU0ZZLEsc/ezxjb" > /root/.ssh/authorized_keys + +VOLUME ["/sys/fs/cgroup"] +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/test/conftest.py new/testinfra-1.14.0/test/conftest.py --- old/testinfra-1.12.0/test/conftest.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/test/conftest.py 2018-06-05 14:56:09.000000000 +0200 @@ -65,6 +65,7 @@ DOCKER_IMAGES = [ "alpine_35", "archlinux", + "centos_6", "centos_7", "debian_stretch", "fedora", @@ -202,7 +203,15 @@ service = testinfra.get_host( docker_id, connection='docker').service - if image in ("centos_7", "fedora"): + images_with_sshd = ( + "centos_6", + "centos_7", + "fedora", + "alpine_35", + "archlinux" + ) + + if image in images_with_sshd: service_name = "sshd" else: service_name = "ssh" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/test/test_backends.py new/testinfra-1.14.0/test/test_backends.py --- old/testinfra-1.12.0/test/test_backends.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/test/test_backends.py 2018-06-05 14:56:29.000000000 +0200 @@ -113,6 +113,18 @@ assert BaseBackend.parse_hostspec(hostspec) == expected [email protected]('hostspec,pod,container,namespace', [ + ('kubectl://pod', 'pod', None, None), + ('kubectl://pod?namespace=n', 'pod', None, 'n'), + ('kubectl://pod?container=c&namespace=n', 'pod', 'c', 'n'), +]) +def test_kubectl_hostspec(hostspec, pod, container, namespace): + backend = testinfra.get_host(hostspec).backend + assert backend.name == pod + assert backend.container == container + assert backend.namespace == namespace + + @pytest.mark.parametrize('arg_string,expected', [ ( 'C:\\Users\\vagrant\\This Dir\\salt', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/test/test_modules.py new/testinfra-1.14.0/test/test_modules.py --- old/testinfra-1.12.0/test/test_modules.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/test/test_modules.py 2018-06-05 14:56:29.000000000 +0200 @@ -23,7 +23,7 @@ all_images = pytest.mark.testinfra_hosts(*[ "docker://{}".format(image) for image in ( - "alpine_35", "archlinux", "centos_7", + "alpine_35", "archlinux", "centos_6", "centos_7", "debian_stretch", "fedora", "ubuntu_xenial" ) ]) @@ -31,6 +31,7 @@ @all_images def test_package(host, docker_image): + assert not host.package('zsh').is_installed if docker_image in ("alpine_35", "archlinux"): name = "openssh" else: @@ -40,6 +41,7 @@ version = { "alpine_35": "7.", "archlinux": "7.", + "centos_6": "5.", "centos_7": "7.", "debian_stretch": "1:7.4", "fedora": "7.", @@ -50,6 +52,7 @@ release = { "alpine_35": "r1", "archlinux": None, + "centos_6": ".el6", "centos_7": ".el7", "debian_stretch": None, "fedora": ".fc27", @@ -68,6 +71,20 @@ assert python.version.startswith("2.7.") [email protected] +def test_uninstalled_package_version(host): + with pytest.raises(AssertionError) as excinfo: + host.package('zsh').version + assert 'Unexpected exit code 1 for CommandResult' in str(excinfo.value) + assert host.package('sudo').is_installed + host.check_output('apt-get -y remove sudo') + assert not host.package('sudo').is_installed + with pytest.raises(AssertionError) as excinfo: + host.package('sudo').version + assert ('The package sudo is not installed, dpkg-query output: ' + 'deinstall ok config-files 1.8.') in str(excinfo.value) + + @all_images def test_systeminfo(host, docker_image): assert host.system_info.type == "linux" @@ -75,6 +92,7 @@ release, distribution, codename = { "alpine_35": ("^3\.5\.", "alpine", None), "archlinux": ("rolling", "arch", None), + "centos_6": (r"^6", "CentOS", None), "centos_7": ("^7$", "centos", None), "debian_stretch": ("^9\.", "debian", "stretch"), "fedora": ("^27$", "fedora", None), @@ -88,7 +106,8 @@ @all_images def test_ssh_service(host, docker_image): - if docker_image in ("centos_7", "fedora", "alpine_35", "archlinux"): + if docker_image in ("centos_6", "centos_7", "fedora", + "alpine_35", "archlinux"): name = "sshd" else: name = "ssh" @@ -96,7 +115,8 @@ ssh = host.service(name) if docker_image == "ubuntu_xenial": assert not ssh.is_running - else: + # FIXME: is_running test is broken for archlinux for unknown reason + elif docker_image != "archlinux": assert ssh.is_running if docker_image == "ubuntu_xenial": @@ -159,6 +179,7 @@ "tcp://127.0.0.1:22", "tcp://:::22", "tcp://::1:22", + "unix:///run/systemd/private", ): socket = host.socket(spec) assert socket.is_listening @@ -186,6 +207,7 @@ args, comm = { "alpine_35": ("/sbin/init", "init"), "archlinux": ("/usr/sbin/init", "systemd"), + "centos_6": ("/usr/sbin/sshd -D", "sshd"), "centos_7": ("/usr/sbin/init", "systemd"), "debian_stretch": ("/sbin/init", "systemd"), "fedora": ("/usr/sbin/init", "systemd"), @@ -274,6 +296,9 @@ assert l.is_symlink assert l.is_file assert l.linked_to == "/d/f" + assert l.linked_to == f + assert f == f + assert not d == f host.check_output("rm -f /d/p && mkfifo /d/p") assert host.file("/d/p").is_pipe diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/backend/__init__.py new/testinfra-1.14.0/testinfra/backend/__init__.py --- old/testinfra-1.12.0/testinfra/backend/__init__.py 2017-10-01 23:25:43.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/backend/__init__.py 2018-06-05 14:56:29.000000000 +0200 @@ -28,6 +28,7 @@ 'ansible': 'testinfra.backend.ansible.AnsibleBackend', 'kubectl': 'testinfra.backend.kubectl.KubectlBackend', 'winrm': 'testinfra.backend.winrm.WinRMBackend', + 'lxc': 'testinfra.backend.lxc.LxcBackend', } @@ -50,7 +51,7 @@ for key in ('sudo', 'ssl', 'verify_ssl'): if query.get(key, ['false'])[0].lower() == 'true': kw[key] = True - for key in ("sudo_user",): + for key in ("sudo_user", 'namespace', 'container'): if key in query: kw[key] = query.get(key)[0] for key in ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/backend/ansible.py new/testinfra-1.14.0/testinfra/backend/ansible.py --- old/testinfra-1.12.0/testinfra/backend/ansible.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/backend/ansible.py 2018-06-04 13:29:42.000000000 +0200 @@ -20,7 +20,6 @@ from testinfra.backend import base from testinfra.utils.ansible_runner import AnsibleRunner from testinfra.utils.ansible_runner import to_bytes -from testinfra.utils import cached_property logger = logging.getLogger("testinfra") @@ -34,9 +33,9 @@ self.ansible_inventory = ansible_inventory super(AnsibleBackend, self).__init__(host, *args, **kwargs) - @cached_property + @property def ansible_runner(self): - return AnsibleRunner(self.ansible_inventory) + return AnsibleRunner.get_runner(self.ansible_inventory) def run(self, command, *args, **kwargs): command = self.get_command(command, *args) @@ -67,4 +66,5 @@ @classmethod def get_hosts(cls, host, **kwargs): - return AnsibleRunner(kwargs.get("ansible_inventory")).get_hosts(host) + inventory = kwargs.get('ansible_inventory') + return AnsibleRunner.get_runner(inventory).get_hosts(host) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/backend/kubectl.py new/testinfra-1.14.0/testinfra/backend/kubectl.py --- old/testinfra-1.12.0/testinfra/backend/kubectl.py 2017-08-31 22:41:39.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/backend/kubectl.py 2018-06-05 14:56:29.000000000 +0200 @@ -21,23 +21,24 @@ NAME = "kubectl" def __init__(self, name, *args, **kwargs): - self.name, self.user = self.parse_containerspec(name) - if "/" in self.name: - self.name, self.container = self.name.split("/", 1) - else: - self.container = None + self.name = name + self.container = kwargs.get('container') + self.namespace = kwargs.get('namespace') super(KubectlBackend, self).__init__(self.name, *args, **kwargs) def run(self, command, *args, **kwargs): cmd = self.get_command(command, *args) # `kubectl exec` does not support specifying the user to run as. # See https://github.com/kubernetes/kubernetes/issues/30656 - if self.container is None: - out = self.run_local( - "kubectl exec %s -- /bin/sh -c %s", self.name, cmd) - else: - out = self.run_local( - "kubectl exec %s -c %s -- /bin/sh -c %s", - self.name, self.container, cmd) - out.command = self.encode(cmd) + kcmd = 'kubectl ' + kcmd_args = [] + if self.namespace is not None: + kcmd += '-n %s ' + kcmd_args.append(self.namespace) + if self.container is not None: + kcmd += '-c %s ' + kcmd_args.append(self.container) + kcmd += 'exec %s -- /bin/sh -c %s' + kcmd_args.extend([self.name, cmd]) + out = self.run_local(kcmd, *kcmd_args) return out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/backend/lxc.py new/testinfra-1.14.0/testinfra/backend/lxc.py --- old/testinfra-1.12.0/testinfra/backend/lxc.py 1970-01-01 01:00:00.000000000 +0100 +++ new/testinfra-1.14.0/testinfra/backend/lxc.py 2018-06-05 14:56:29.000000000 +0200 @@ -0,0 +1,32 @@ +# coding: utf-8 +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import unicode_literals +from __future__ import absolute_import + +from testinfra.backend import base + + +class LxcBackend(base.BaseBackend): + NAME = "lxc" + + def __init__(self, name, *args, **kwargs): + self.name = name + super(LxcBackend, self).__init__(self.name, *args, **kwargs) + + def run(self, command, *args, **kwargs): + cmd = self.get_command(command, *args) + out = self.run_local("lxc exec %s --mode=non-interactive -- " + "/bin/sh -c %s", self.name, cmd) + out.command = self.encode(cmd) + return out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/backend/paramiko.py new/testinfra-1.14.0/testinfra/backend/paramiko.py --- old/testinfra-1.12.0/testinfra/backend/paramiko.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/backend/paramiko.py 2018-05-10 14:54:44.000000000 +0200 @@ -75,6 +75,10 @@ elif key == "requesttty": if cfg[key] in ('yes', 'force'): self.get_pty = True + elif key == "gssapikeyexchange": + cfg['gss_auth'] = (value == 'yes') + elif key == "gssapiauthentication": + cfg['gss_kex'] = (value == 'yes') if self.ssh_identity_file: cfg["key_filename"] = self.ssh_identity_file client.connect(**cfg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/backend/winrm.py new/testinfra-1.14.0/testinfra/backend/winrm.py --- old/testinfra-1.12.0/testinfra/backend/winrm.py 2017-10-01 23:25:43.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/backend/winrm.py 2018-05-05 14:44:28.000000000 +0200 @@ -68,7 +68,7 @@ self.host = self.parse_hostspec(hostspec) self.conn_args = { 'endpoint': '{}://{}{}/wsman'.format( - 'http' if no_ssl else 'http', + 'http' if no_ssl else 'https', self.host.name, ':{}'.format(self.host.port) if self.host.port else ''), 'transport': 'ntlm', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/modules/file.py new/testinfra-1.14.0/testinfra/modules/file.py --- old/testinfra-1.12.0/testinfra/modules/file.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/modules/file.py 2018-06-04 13:29:42.000000000 +0200 @@ -14,6 +14,7 @@ from __future__ import unicode_literals import datetime +import six from testinfra.modules.base import Module @@ -171,6 +172,16 @@ def __repr__(self): return "<file %s>" % (self.path,) + def __eq__(self, other): + if isinstance(other, File): + return self.path == other.path + elif isinstance(other, six.string_types): + return self.path == other + return False + + def __ne__(self, other): + return not self.__eq__(other) + @classmethod def get_module_class(cls, host): if host.system_info.type == "linux": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/modules/package.py new/testinfra-1.14.0/testinfra/modules/package.py --- old/testinfra-1.12.0/testinfra/modules/package.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/modules/package.py 2018-05-28 20:10:22.000000000 +0200 @@ -85,8 +85,10 @@ @property def is_installed(self): - out = self.check_output("dpkg-query -f '${Status}' -W %s" % ( - self.name,)).split() + result = self.run_test("dpkg-query -f '${Status}' -W %s", self.name) + if result.rc == 1: + return False + out = result.stdout.strip().split() installed_status = ["ok", "installed"] return out[0] in ["install", "hold"] and out[1:3] == installed_status @@ -96,10 +98,13 @@ @property def version(self): - out = self.check_output("dpkg-query -f '${Status} ${Version}' -W %s" - % (self.name,)).split() - if out[0].lower() in ["install", "hold"]: - return out[3] + out = self.check_output("dpkg-query -f '${Status} ${Version}' -W %s", + self.name) + splitted = out.split() + assert splitted[0].lower() in ('install', 'hold'), ( + "The package %s is not installed, dpkg-query output: %s" % ( + self.name, out)) + return splitted[3] class FreeBSDPackage(Package): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/modules/service.py new/testinfra-1.14.0/testinfra/modules/service.py --- old/testinfra-1.12.0/testinfra/modules/service.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/modules/service.py 2018-06-04 13:29:42.000000000 +0200 @@ -93,7 +93,7 @@ @property def is_enabled(self): return bool(self.check_output( - "find /etc/rc?.d/ -name %s", + "find -L /etc/rc?.d/ -name %s", "S??" + self.name, )) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/modules/socket.py new/testinfra-1.14.0/testinfra/modules/socket.py --- old/testinfra-1.12.0/testinfra/modules/socket.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/modules/socket.py 2018-06-05 14:56:29.000000000 +0200 @@ -220,16 +220,24 @@ cmd += ' --unix' for line in self.run(cmd).stdout_bytes.splitlines()[1:]: + # Ignore unix datagram sockets. if line.split(None, 1)[0] == b'u_dgr': continue splitted = line.decode().split() - if self.protocol: + + # If listing only TCP or UDP sockets, output has 5 columns: + # (State, Recv-Q, Send-Q, Local Address:Port, Peer Address:Port) + if self.protocol in ('tcp', 'udp'): protocol = self.protocol status, local, remote = ( splitted[0], splitted[3], splitted[4]) + # If listing all or just unix sockets, output has 6 columns: + # Netid, State, Recv-Q, Send-Q, LocalAddress:Port, PeerAddress:Port else: protocol, status, local, remote = ( splitted[0], splitted[1], splitted[4], splitted[5]) + + # ss reports unix socket as u_str. if protocol == 'u_str': protocol = 'unix' host, port = local, None @@ -238,12 +246,16 @@ port = int(port) else: continue - if listening and status == 'LISTEN': - if host == '*': + + # UDP listening sockets may be in 'UNCONN' status. + if listening and status in ('LISTEN', 'UNCONN'): + if host == '*' and protocol in ('tcp', 'udp'): yield protocol, '::', port yield protocol, '0.0.0.0', port - else: + elif protocol in ('tcp', 'udp'): yield protocol, host, port + else: + yield protocol, host elif not listening and status == 'ESTAB': if protocol in ('tcp', 'udp'): remote_host, remote_port = remote.rsplit(':', 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/plugin.py new/testinfra-1.14.0/testinfra/plugin.py --- old/testinfra-1.12.0/testinfra/plugin.py 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/plugin.py 2018-05-28 15:46:19.000000000 +0200 @@ -146,7 +146,7 @@ sudo_user=metafunc.config.option.sudo_user, ansible_inventory=metafunc.config.option.ansible_inventory, ) - ids = [e.backend.get_pytest_id() for e in params] + ids = sorted([e.backend.get_pytest_id() for e in params]) metafunc.parametrize( "_testinfra_host", params, ids=ids, scope="module") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra/utils/ansible_runner.py new/testinfra-1.14.0/testinfra/utils/ansible_runner.py --- old/testinfra-1.12.0/testinfra/utils/ansible_runner.py 2018-04-24 21:19:37.000000000 +0200 +++ new/testinfra-1.14.0/testinfra/utils/ansible_runner.py 2018-06-04 13:29:42.000000000 +0200 @@ -53,6 +53,7 @@ class AnsibleRunnerBase(object): + _runners = {} def __init__(self, host_list=None): self.host_list = host_list @@ -67,6 +68,14 @@ def run(self, host, module_name, module_args, **kwargs): raise NotImplementedError + @classmethod + def get_runner(cls, inventory): + try: + return cls._runners[inventory] + except KeyError: + cls._runners[inventory] = cls(inventory) + return cls._runners[inventory] + class AnsibleRunnerV1(AnsibleRunnerBase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra.egg-info/PKG-INFO new/testinfra-1.14.0/testinfra.egg-info/PKG-INFO --- old/testinfra-1.12.0/testinfra.egg-info/PKG-INFO 2018-04-24 21:21:47.000000000 +0200 +++ new/testinfra-1.14.0/testinfra.egg-info/PKG-INFO 2018-06-05 15:01:11.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: testinfra -Version: 1.12.0 +Version: 1.14.0 Summary: Test infrastructures Home-page: http://github.com/philpep/testinfra Author: Philippe Pepiot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra.egg-info/SOURCES.txt new/testinfra-1.14.0/testinfra.egg-info/SOURCES.txt --- old/testinfra-1.12.0/testinfra.egg-info/SOURCES.txt 2018-04-24 21:21:47.000000000 +0200 +++ new/testinfra-1.14.0/testinfra.egg-info/SOURCES.txt 2018-06-05 15:01:12.000000000 +0200 @@ -26,6 +26,7 @@ doc/source/_templates/piwik.html images/alpine_35/Dockerfile images/archlinux/Dockerfile +images/centos_6/Dockerfile images/centos_7/Dockerfile images/debian_stretch/Dockerfile images/fedora/Dockerfile @@ -53,6 +54,7 @@ testinfra/backend/docker.py testinfra/backend/kubectl.py testinfra/backend/local.py +testinfra/backend/lxc.py testinfra/backend/paramiko.py testinfra/backend/salt.py testinfra/backend/ssh.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/testinfra.egg-info/pbr.json new/testinfra-1.14.0/testinfra.egg-info/pbr.json --- old/testinfra-1.12.0/testinfra.egg-info/pbr.json 2018-04-24 21:21:47.000000000 +0200 +++ new/testinfra-1.14.0/testinfra.egg-info/pbr.json 2018-06-05 15:01:11.000000000 +0200 @@ -1 +1 @@ -{"is_release": true, "git_version": "a1a2ca9"} \ No newline at end of file +{"is_release": true, "git_version": "0e9ae4b"} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/testinfra-1.12.0/tox.ini new/testinfra-1.14.0/tox.ini --- old/testinfra-1.12.0/tox.ini 2018-04-22 14:47:02.000000000 +0200 +++ new/testinfra-1.14.0/tox.ini 2018-06-04 13:29:42.000000000 +0200 @@ -6,7 +6,7 @@ -rtest-requirements.txt ansible>=2.4,<3 commands= - testinfra {posargs:-v -n 4 --cov testinfra --cov-report xml --cov-report term test} + py.test {posargs:-v -n 4 --cov testinfra --cov-report xml --cov-report term test} usedevelop=True passenv=HOME TRAVIS DOCKER_CERT_PATH DOCKER_HOST DOCKER_TLS_VERIFY @@ -16,9 +16,9 @@ -rtest-requirements.txt ansible>=1,<2 commands= - testinfra {posargs:-v -k ansible test} + py.test {posargs:-v -k ansible test} usedevelop=True -passenv=HOME TRAVIS +passenv=HOME TRAVIS DOCKER_CERT_PATH DOCKER_HOST DOCKER_TLS_VERIFY [testenv:flake8] basepython=python3
