diff --git a/endpoints/endpoints.py b/endpoints/endpoints.py index 01ffd5c3..1ef7b74d 100644 --- a/endpoints/endpoints.py +++ b/endpoints/endpoints.py @@ -249,6 +249,23 @@ def log_cli(args): return 0 +def log_env(): + """ + Log the environment variables in a readable form + + Args: + None + + Globals: + None + + Returns: + 0 + """ + log.info("Logging Environment Variables:\n%s" % (dump_json(dict(os.environ)))) + + return 0 + def cli_stream(): """ Recreate the argument list that the script was called with diff --git a/endpoints/remotehosts/remotehosts.py b/endpoints/remotehosts/remotehosts.py index e6837f34..5e7d425a 100755 --- a/endpoints/remotehosts/remotehosts.py +++ b/endpoints/remotehosts/remotehosts.py @@ -67,6 +67,8 @@ def validate(): Returns: int: zero for success / non-zero for failure """ + endpoints.validate_comment("environment: %s" % (dict(os.environ))) + endpoints.validate_comment("params: %s" % (endpoints.cli_stream())) endpoints.validate_comment("argparse: %s" % (args)) @@ -2042,11 +2044,22 @@ def remote_image_manager(thread_name, remote_name, connection, image_max_cache_s deletes["rickshaw"] = [] deletes["podman"] = [] for image in images["podman"].keys(): - m = re.search(r"client-server", image) + image_repo = os.environ.get("RS_REG_REPO") + if image_repo is None: + image_prefix = r"client-server" + thread_logger(thread_name, "Using default podman image prefix '%s'" % (image_prefix), log_level = "warning", remote_name = remote_name, log_prefix = log_prefix) + else: + image_prefix = image_repo.split("/") + image_prefix = image_prefix[len(image_prefix) - 1] + thread_logger(thread_name, "Using podman image prefix '%s'" % (image_prefix), remote_name = remote_name, log_prefix = log_prefix) + + m = re.search(image_prefix, image) if m is None: - thread_logger(thread_name, "Podman image '%s' is not a client-server image, ignoring" % (image), remote_name = remote_name, log_prefix = log_prefix) + thread_logger(thread_name, "Podman image '%s' is not a '%s' image, ignoring" % (image, image_prefix), remote_name = remote_name, log_prefix = log_prefix) deletes["podman"].append(image) continue + else: + thread_logger(thread_name, "Podman image '%s' is a '%s' image, processing" % (image, image_prefix), remote_name = remote_name, log_prefix = log_prefix) if not image in images["rickshaw"]: thread_logger(thread_name, "Podman image '%s' is not present in rickshaw container image census, removing it from the image cache" % (image), remote_name = remote_name, log_prefix = log_prefix) @@ -2545,6 +2558,7 @@ def main(): log = endpoints.setup_logger(args.log_level) + endpoints.log_env() endpoints.log_cli(args) init_settings() if load_settings() != 0: