def get_repository_json(namespace, repository): json_path = store.repository_json_path(namespace, repository) headers = {} data = {'last_update': None, 'docker_version': None, 'docker_go_version': None, 'arch': 'amd64', 'os': 'linux', 'kernel': None} try: data = json.loads(store.get_content(json_path)) except IOError: if mirroring.is_mirror(): # use code 404 to trigger the source_lookup decorator. # TODO(joffrey): make sure this doesn't break anything or have the # decorator rewrite the status code before sending return toolkit.response(data, code=404, headers=headers) # else we ignore the error, we'll serve the default json declared above return toolkit.response(data, headers=headers)
def get_repository_json(namespace, repository): json_path = store.repository_json_path(namespace, repository) headers = {} data = { 'last_update': None, 'docker_version': None, 'docker_go_version': None, 'arch': 'amd64', 'os': 'linux', 'kernel': None } try: data = json.loads(store.get_content(json_path)) except IOError: if mirroring.is_mirror(): # use code 404 to trigger the source_lookup decorator. # TODO(joffrey): make sure this doesn't break anything or have the # decorator rewrite the status code before sending return toolkit.response(data, code=404, headers=headers) # else we ignore the error, we'll serve the default json declared above return toolkit.response(data, headers=headers)
def test_is_mirror(self): self.assertEqual(mirroring.is_mirror(), True)