Skip to content

Commit a087dd2

Browse files
author
Phil Rzewski
committed
In get_notification_ids, add the ability to search by channel name instead of just email recipients
1 parent 947ead2 commit a087dd2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sdcclient/_client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,14 @@ def get_notification_ids(self, channels):
126126
ids.append(ch['id'])
127127
elif c['type'] == 'EMAIL':
128128
opt = ch['options']
129-
if set(c['emailRecipients']) == set(opt['emailRecipients']):
130-
found = True
131-
ids.append(ch['id'])
129+
if 'emailRecipients' in c:
130+
if set(c['emailRecipients']) == set(opt['emailRecipients']):
131+
found = True
132+
ids.append(ch['id'])
133+
elif 'name' in c:
134+
if c['name'] == ch['name']:
135+
found = True
136+
ids.append(ch['id'])
132137
elif c['type'] == 'PAGER_DUTY':
133138
opt = ch['options']
134139
if opt['account'] == c['account'] and opt['serviceName'] == c['serviceName']:

0 commit comments

Comments
 (0)