Please review attached patch for pytest-multihost plugin.

Fixes:  https://fedorahosted.org/python-pytest-multihost/ticket/4


Scott Poore 
Senior Quality Assurance Engineer
Red Hat, Inc.

From 5fadf05ee1be771e966b67007c0cc3e529e6308c Mon Sep 17 00:00:00 2001
From: Scott Poore <spo...@redhat.com>
Date: Fri, 12 Feb 2016 14:03:50 -0600
Subject: [PATCH] Add reset_connection to BaseHost class

Add ability to reset the ssh connection via del host._transport.
This is to allow cases where hostname or ip used for the ssh
connection may change.


Signed-off-by: Scott Poore <spo...@redhat.com>
 pytest_multihost/host.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pytest_multihost/host.py b/pytest_multihost/host.py
index f3346f60e3c48d79e85f88aa2387e4c89ee38f08..feacb31f98a8abea60c37fdd9a67346c5455ea1b 100644
--- a/pytest_multihost/host.py
+++ b/pytest_multihost/host.py
@@ -147,6 +147,12 @@ class BaseHost(object):
                 raise NotImplementedError('transport class not available')
             return self._transport
+    def reset_connection(self):
+        try:
+            del self._transport
+        except:
+            pass
     def get_file_contents(self, filename, encoding=None):
         """Shortcut for transport.get_file_contents"""
         return self.transport.get_file_contents(filename, encoding=encoding)

Manage your subscription for the Freeipa-devel mailing list:
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to