Skip to content

sdclient.get_notification_ids returns keyerror for slack. #2

@gileshinchcliff

Description

@gileshinchcliff

When I run:

slack = [{'type': 'SLACK', 'channel': 'ops-alerts'}]
        slack_id = sdclient.get_notification_ids(slack)
        if not slack_id[0]:
            print "Could not get IDs and hence not creating the alert"
            sys.exit(-1)
        print slack_id

or even just the create_alarm.py example
I get

{'type': 'SLACK', 'channel': 'ops-alerts'} {u'modifiedOn': 1470132611000, u'name': u'sysdig', u'createdOn': 1470132611000, u'enabled': True, u'options': {u'notifyOnOk': False, u'url': u'<REDACTED>'}, u'version': 1, u'type': u'SLACK', u'id': 2}
Traceback (most recent call last):
  File "./create_alert.py", line 35, in <module>
    res = sdclient.get_notification_ids(notify_channels)
  File "/home/giles/work/homeoffice/python-sdc-client/examples/../sdcclient/_client.py", line 131, in get_notification_ids
    if opt['channel'] == c['channel']:
KeyError: 'channel'

Seems to be a bug in the library, doesn't happen with the email and seems to return the slack channel id correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions