From 4ffcd86d449f80d70ab200279acc4a660f7feb4a Mon Sep 17 00:00:00 2001 From: Brandon Squizzato <35474886+bsquizz@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:53:44 -0500 Subject: [PATCH] Log warning if app/env resource has 'disabled: true' (#176) --- bonfire/processor.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bonfire/processor.py b/bonfire/processor.py index ac1776fe..f3eb3187 100644 --- a/bonfire/processor.py +++ b/bonfire/processor.py @@ -54,6 +54,19 @@ def _set_replicas(items): log.debug("set replicas to '1' on ClowdApp '%s'", i["metadata"]["name"]) +def _check_for_disabled(items): + for item in items: + kind = item.get("kind", "").lower() + name = item.get("metadata", {}).get("name") + if kind in ["clowdapp", "clowdenvironment"]: + if item.get("spec", {}).get("disabled"): + log.warning( + "%s/%s has 'disabled: true' configured, Clowder will ignore it", + kind, + name, + ) + + def process_clowd_env(target_ns, quay_user, env_name, template_path, local=True): log.info("processing ClowdEnvironment") @@ -78,6 +91,8 @@ def process_clowd_env(target_ns, quay_user, env_name, template_path, local=True) if not processed_template.get("items"): raise FatalError("Processed ClowdEnvironment template has no items") + _check_for_disabled(processed_template["items"]) + return processed_template @@ -429,9 +444,12 @@ def _get_component_items(self, component_name): and component_name not in self.no_remove_resources ): _remove_resource_config(new_items) + if self.single_replicas: _set_replicas(new_items) + _check_for_disabled(new_items) + return new_items def _process_component(self, component_name):