Skip to content

Commit 76449a7

Browse files
committed
Use logging.warning instead of warnings module (caught and printed by click-log in the CLI)
1 parent 4dc744e commit 76449a7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ecs_deploy/ecs.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import re
44
import copy
55
from collections import defaultdict
6-
import warnings
76
import logging
87
import click_log
98

@@ -967,7 +966,7 @@ def add_containers(self, containers_list):
967966
containers_tmp = list(self.containers)
968967
for container in set(containers_list):
969968
if container in self.container_names:
970-
warnings.warn("Cannot add container '{container}', already in the task definition.".format(container=container))
969+
logger.warning("Cannot add container '{container}', already in the task definition.".format(container=container))
971970
continue
972971
mapping = {}
973972
mapping["name"] = container
@@ -1003,12 +1002,12 @@ def remove_containers(self, containers_list):
10031002
containers_not_found = list(containers_ - set(self.container_names))
10041003
# Remaining containers could not be found.
10051004
for container in containers_not_found:
1006-
warnings.warn("Cannot remove container '{container}', not in the task definition.".format(container=container))
1005+
logger.warning("Cannot remove container '{container}', not in the task definition.".format(container=container))
10071006

10081007
if containers:
10091008
self.containers = containers
10101009
else:
1011-
warnings.warn("No container left after removal. Using original containers, not removing '{containers_}'.".format(container=container))
1010+
logger.warning("No container left after removal. Using original containers, not removing '{containers_}'.".format(container=container))
10121011

10131012
if not self.containers == containers_tmp:
10141013
diff = EcsTaskDefinitionDiff(

0 commit comments

Comments
 (0)