Skip to content

Commit

Permalink
- Fixed ECSService alarms when more than one service is used.
Browse files Browse the repository at this point in the history
  • Loading branch information
gitwater committed Jun 25, 2021
1 parent bf6cc24 commit 12391f2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/paco/cftemplates/cw_alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,15 @@ def __init__(self, stack, paco_ctx):
# ECSServices can have Alarms for every Service
if schemas.IECSServices.providedBy(resource):
for service in resource.services.values():
if service.monitoring == None or service.monitoring.is_enabled() == False:
continue
if getattr(service, 'monitoring', None) != None and getattr(service.monitoring, 'alarm_sets', None) != None:
alarm_sets = service.monitoring.alarm_sets
for alarm_set_name in alarm_sets.keys():
alarm_set = alarm_sets[alarm_set_name]
for alarm_name, alarm in alarm_set.items():
cfn_resource_name = 'Alarm{}{}'.format(
cfn_resource_name = 'Alarm{}{}{}'.format(
self.create_cfn_logical_id(service.name),
self.create_cfn_logical_id(alarm_set_name),
self.create_cfn_logical_id(alarm_name)
)
Expand Down

0 comments on commit 12391f2

Please sign in to comment.