22 lines
699 B
Python
22 lines
699 B
Python
import os
|
|
import logging
|
|
|
|
from data.registry_model.registry_pre_oci_model import pre_oci_model
|
|
from data.registry_model.registry_oci_model import oci_model
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class RegistryModelProxy(object):
|
|
def __init__(self):
|
|
self._model = oci_model if os.getenv('OCI_DATA_MODEL') == 'true' else pre_oci_model
|
|
|
|
def set_for_testing(self, use_oci_model):
|
|
self._model = oci_model if use_oci_model else pre_oci_model
|
|
logger.debug('Changed registry model to `%s` for testing', self._model)
|
|
|
|
def __getattr__(self, attr):
|
|
return getattr(self._model, attr)
|
|
|
|
registry_model = RegistryModelProxy()
|
|
logger.debug('Using registry model `%s`', registry_model._model)
|