Skip to content
Snippets Groups Projects
Unverified Commit 3c34bbd0 authored by ysde's avatar ysde Committed by GitHub
Browse files

Merge pull request #38 from zot24/fix/uid-doesnt-exist-channel-object

fix: uid doesn't exist on channel object
parents 58a77410 49809f34
No related branches found
No related tags found
No related merge requests found
......@@ -23,21 +23,26 @@ def get_all_alert_channels_in_grafana():
return []
def save_alert_channel(channel_name, file_name, alert_channel_setting):
file_path = folder_path + '/' + file_name + '.alert_channel'
file_path = folder_path + '/' + str(file_name) + '.alert_channel'
with open(file_path, 'w') as f:
f.write(json.dumps(alert_channel_setting))
print("alert_channel:{0} is saved to {1}".format(channel_name, file_path))
def get_indivisual_alert_channel_and_save(channels):
for channel in channels:
if 'uid' in channel:
channel_identifier = channel['uid']
else:
channel_identifier = channel['id']
save_alert_channel(
to_python2_and_3_compatible_string(channel['name']),
channel['uid'],
to_python2_and_3_compatible_string(channel_identifier),
channel
)
file_path = folder_path + '/' + log_file
with open(u"{0}".format(file_path) , 'w+') as f:
f.write('{}\t{}'.format(channel['uid'], to_python2_and_3_compatible_string(channel['name'])))
f.write('{}\t{}'.format(to_python2_and_3_compatible_string(channel_identifier), to_python2_and_3_compatible_string(channel['name'])))
alert_channels = get_all_alert_channels_in_grafana()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment