diff --git a/.travis.yml b/.travis.yml index fb9f9bb..8c319ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ cache: env: global: - PIPENV_IGNORE_VIRTUALENVS=1 + - PIPENV_PYUP_API_KEY="" install: - (cd manager && pipenv install --dev --deploy) - (cd orchestrator && pipenv install --dev --deploy) diff --git a/orchestrator/orchestrator/views/registry/__init__.py b/orchestrator/orchestrator/views/registry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/orchestrator/orchestrator/views/registry/api.py b/orchestrator/orchestrator/views/registry/api.py new file mode 100644 index 0000000..33a724c --- /dev/null +++ b/orchestrator/orchestrator/views/registry/api.py @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: MIT +# (c) 2019 The TJHSST Director 4.0 Development Team & Contributors +import traceback +from typing import Tuple, Union + +from flask import Blueprint, current_app + +from ....docker.registry import get_registry_images +from ..exceptions import OrchestratorActionError + +api = Blueprint("api", __name__) + + +@api.route("/registry/api/images", method=["GET"]) +def get_registry_images_page() -> Union[str, Tuple[str, int]]: + """Returns Docker registry images. + + Returns in JSON format. + """ + + try: + images = get_registry_images() + except OrchestratorActionError as ex: + current_app.logger.error("%s", traceback.format_exc()) + return str(ex), 500 + except BaseException: # pylint: disable=broad-except + current_app.logger.error("%s", traceback.format_exc()) + return "Error", 500 + else: + return str(images)