Skip to content
Snippets Groups Projects
Commit 49809f34 authored by Israel Sotomayor's avatar Israel Sotomayor
Browse files

chg: check for uid first and fallback to id

parent df4e3383
No related branches found
No related tags found
No related merge requests found
......@@ -30,14 +30,19 @@ def save_alert_channel(channel_name, file_name, alert_channel_setting):
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']),
to_python2_and_3_compatible_string(channel['id']),
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(to_python2_and_3_compatible_string(channel['id']), 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