connection: support checking for a list of features

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.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2018-02-22 12:34:18 +01:00 committed by Cole Robinson
parent 6954c6774a
commit 39721cbe1b
1 changed files with 13 additions and 7 deletions

View File

@ -409,13 +409,19 @@ class VirtualConnection(object):
_supportname.startswith("SUPPORT_")]:
locals()[_supportname] = getattr(support, _supportname)
def check_support(self, feature, data=None):
key = feature
data = data or self
if key not in self._support_cache:
self._support_cache[key] = support.check_support(
self, feature, data)
return self._support_cache[key]
def check_support(self, features, data=None):
def _check_support(key):
if key not in self._support_cache:
self._support_cache[key] = support.check_support(
self, key, data or self)
return self._support_cache[key]
for f in util.listify(features):
# 'and' condition over the feature list
if not _check_support(f):
return False
return True
def support_remote_url_install(self):
if self._magic_uri: