From cc609246a2e1ec44f22f3ccd427ef9e735c51754 Mon Sep 17 00:00:00 2001 From: David Goh Date: Mon, 13 Nov 2023 14:42:16 +1100 Subject: [PATCH] Don't try to Name filter unless things are Environment #707 --- ecs_composex/ecs/ecs_family/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ecs_composex/ecs/ecs_family/__init__.py b/ecs_composex/ecs/ecs_family/__init__.py index 3bd368eb..217bfae4 100644 --- a/ecs_composex/ecs/ecs_family/__init__.py +++ b/ecs_composex/ecs/ecs_family/__init__.py @@ -526,9 +526,9 @@ def sort_env_vars_alphabetically(self): secret_names = frozenset() environment = getattr(service.container_definition, "Environment") if environment: - remove_secrets = [_env for _env in environment if _env.Name not in secret_names] - original = [_env for _env in remove_secrets if isinstance(_env, Environment)] - sorted_env = sorted(original, key=lambda x: x.Name) + original = [_env for _env in environment if isinstance(_env, Environment)] + remove_secrets = [_env for _env in original if _env.Name not in secret_names] + sorted_env = sorted(remove_secrets, key=lambda x: x.Name) for _env in environment: if not isinstance(_env, Environment): sorted_env.append(_env)