Allow namespaces to be whitelisted for OCI, but not V22

This commit is contained in:
Joseph Schorr 2019-01-21 14:40:26 -05:00
parent 92808e8d3f
commit 7c241a93f6
4 changed files with 13 additions and 7 deletions

View file

@ -11,9 +11,12 @@ logger = logging.getLogger(__name__)
class SplitModel(object):
def __init__(self, v22_namespace_whitelist):
def __init__(self, oci_namespace_whitelist, v22_namespace_whitelist):
self.v22_namespace_whitelist = set(v22_namespace_whitelist)
self.oci_namespace_whitelist = set(oci_namespace_whitelist)
self.oci_namespace_whitelist.update(v22_namespace_whitelist)
def supports_schema2(self, namespace_name):
""" Returns whether the implementation of the data interface supports schema 2 format
manifests. """
@ -72,7 +75,7 @@ class SplitModel(object):
args_dict = {argnames[index + 1]: value for index, value in enumerate(args)}
namespace_name = self._namespace_from_kwargs(args_dict)
if namespace_name in self.v22_namespace_whitelist:
if namespace_name in self.oci_namespace_whitelist:
logger.debug('Calling method `%s` under OCI data model for namespace `%s`',
attr, namespace_name)
return getattr(oci_model, attr)(*args, **kwargs)