def set_in_index(self, documentList): """ Store the list of documents in the Elasticsearch index via HTTP APIs @type documentList: List @param documentList: List of image layer JSON documents """ #Get the Elasticsearch address from the config file cfg = config.load() #Store the document list in Elasticsearch es = ElasticSearch(cfg.search_options.get("address")) try: es.bulk_index(cfg.search_options.get("index"), cfg.search_options.get("type"), documentList, id_field='id') except InvalidJsonResponseError: logger.debug("InvalidJsonResponseError!") except Timeout: logger.debug("Timeout!") except ConnectionError: logger.debug("ConnectionError!") except ElasticHttpError: logger.debug("ElasticHttpError!") except InvalidJsonResponseError: logger.debug("InvalidJsonResponseError!") except ElasticHttpNotFoundError: logger.debug("ElasticHttpNotFoundError!")
def __init__(self): cfg = config.load() try: self.storage = Storage(path=None,config=cfg) except Exception as err: log.error(err) raise FuseOSError(-100)
def load(): global _config reg_config = config.load() dbname = _get_or_set('extensions.dynamodb_index.database', 'docker-registry', 'DYNAMODB_DATABASE') _get_or_set('extensions.dynamodb_index.repository_table', dbname + '-repository', 'DYNAMODB_REPOSITORY_TABLE') _get_or_set('extensions.dynamodb_index.version_table', dbname + '-version', 'DYNAMODB_REPOSITORY_TABLE') region = _get_or_set('extensions.dynamodb_index.region', reg_config.s3_region, 'DYNAMODB_REGION') if region is None: _config['extensions.dynamodb_index.region'] = 'us-east-1' _get_or_set('extensions.dynamodb_index.access_key', reg_config.s3_access_key, 'DYNAMODB_ACCESS_KEY') _get_or_set('extensions.dynamodb_index.secret_access_key', reg_config.s3_secret_key, 'DYNAMODB_SECRET_ACCESS_KEY') return _config
def setUp(self): self.cfg = config.load() self.cfg._config['mirroring'] = {'source': 'https://registry.mock'}
sess = requests.Session() adapter = requests.adapters.HTTPAdapter(pool_connections=100, pool_maxsize=100) sess.mount('https://', adapter) requests = sess from docker_registry.lib import checksums from docker_registry.lib import config import docker_registry.storage as storage import base from docker_registry.core import compat json = compat.json StringIO = compat.StringIO cfg = config.load() ua = 'docker/1.0.0 registry test pretending to be docker' class TestWorkflow(base.TestCase): # Dev server needs to run on port 5000 in order to run this test registry_endpoint = os.environ.get( 'DOCKER_REGISTRY_ENDPOINT', 'https://registrystaging-docker.dotcloud.com') #registry_endpoint = 'http://localhost:5000' index_endpoint = os.environ.get( 'DOCKER_INDEX_ENDPOINT', 'https://indexstaging-docker.dotcloud.com') # export DOCKER_CREDS="login:password"
def setUp(self): self.cfg = config.load() self.cfg._config['mirroring'] = { 'source': 'https://registry.mock' }
def setUp(self): config.load() config._config._config["mirroring"] = {"source": "https://registry.mock"} self.cfg = config.load()