From 46cec15cfe6ba1f01675ee6df0bba0172a14777d Mon Sep 17 00:00:00 2001 From: Theo Ouzhinski Date: Tue, 5 May 2020 14:35:09 -0400 Subject: [PATCH] travis: set blank PIPENV_PYUP_API_KEY workaround for `pipenv check` pyup.io safety check. pyup.io recently removed the requirement for a custom API key for pipenv's safety check, and, until an upstream pipenv release can be delivered, this is the suggested workaround. Previously, an error occured during `pipenv check` since pipenv was using an API key. See `https://github.com/pypa/pipenv/issues/4188` --- .travis.yml | 1 + .../orchestrator/views/registry/__init__.py | 0 .../orchestrator/views/registry/api.py | 30 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 orchestrator/orchestrator/views/registry/__init__.py create mode 100644 orchestrator/orchestrator/views/registry/api.py 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)