From: Marc-André Lureau <marcandre.lur...@redhat.com>

Make check_support() accept a list of features.

This will let tests have more complex conditions on the features they
require.

Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
---
 virtinst/connection.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/virtinst/connection.py b/virtinst/connection.py
index 3d1f73d2..40438d9a 100644
--- a/virtinst/connection.py
+++ b/virtinst/connection.py
@@ -409,7 +409,7 @@ class VirtualConnection(object):
                          _supportname.startswith("SUPPORT_")]:
         locals()[_supportname] = getattr(support, _supportname)
 
-    def check_support(self, feature, data=None):
+    def _check_support(self, feature, data=None):
         key = feature
         data = data or self
         if key not in self._support_cache:
@@ -417,6 +417,16 @@ class VirtualConnection(object):
                 self, feature, data)
         return self._support_cache[key]
 
+    def check_support(self, features, data=None):
+        if isinstance(features, list):
+            # 'and' condition over the feature list
+            for f in features:
+                if not self._check_support(f, data):
+                    return False
+            return True
+        else:
+            return self._check_support(features, data)
+
     def support_remote_url_install(self):
         if self._magic_uri:
             return False
-- 
2.16.1.73.g5832b7e9f2

_______________________________________________
virt-tools-list mailing list
virt-tools-list@redhat.com
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to