Create wrapper tool for both local and remote shell command execution.
Create base function called execute that takes a command and execute
it using either subprocess module or an SSH client to allow
implementing commands wrapper that can be executed either locally or
remotelly.
It also try to handle timeouts and produce good error capable of
reporting whats written to stdout and stderr.
Change-Id: I1a30b82338f44a4182722973e7ad3da2872295fd
diff --git a/neutron_tempest_plugin/common/utils.py b/neutron_tempest_plugin/common/utils.py
index fa7bb8b..3649cb6 100644
--- a/neutron_tempest_plugin/common/utils.py
+++ b/neutron_tempest_plugin/common/utils.py
@@ -88,3 +88,17 @@
raise self.skipTest(msg)
return inner
return decor
+
+
+def override_class(overriden_class, overrider_class):
+ """Override class definition with a MixIn class
+
+ If overriden_class is not a subclass of overrider_class then it creates
+ a new class that has as bases overrider_class and overriden_class.
+ """
+
+ if not issubclass(overriden_class, overrider_class):
+ name = overriden_class.__name__
+ bases = (overrider_class, overriden_class)
+ overriden_class = type(name, bases, {})
+ return overriden_class