Skip to content

Commit

Permalink
Log warning if app/env resource has 'disabled: true' (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsquizz authored Feb 1, 2022
1 parent a2e81e7 commit 4ffcd86
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bonfire/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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


Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 4ffcd86

Please sign in to comment.