Skip to content
Snippets Groups Projects
Commit 943e944b authored by arthur.yueh's avatar arthur.yueh
Browse files

change open file mode of fix #52

parent e45a740f
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ def save_alert_channel(channel_name, file_name, alert_channel_setting): ...@@ -31,7 +31,7 @@ def save_alert_channel(channel_name, file_name, alert_channel_setting):
def get_indivisual_alert_channel_and_save(channels): def get_indivisual_alert_channel_and_save(channels):
file_path = folder_path + '/' + log_file file_path = folder_path + '/' + log_file
if channels: if channels:
with open(u"{0}".format(file_path) , 'w+') as f: with open(u"{0}".format(file_path) , 'w') as f:
for channel in channels: for channel in channels:
if 'uid' in channel: if 'uid' in channel:
channel_identifier = channel['uid'] channel_identifier = channel['uid']
...@@ -43,7 +43,7 @@ def get_indivisual_alert_channel_and_save(channels): ...@@ -43,7 +43,7 @@ def get_indivisual_alert_channel_and_save(channels):
to_python2_and_3_compatible_string(str(channel_identifier)), to_python2_and_3_compatible_string(str(channel_identifier)),
channel channel
) )
f.write('{}\t{}'.format(to_python2_and_3_compatible_string(str(channel_identifier)), to_python2_and_3_compatible_string(channel['name']))) f.write('{}\t{}\n'.format(to_python2_and_3_compatible_string(str(channel_identifier)), to_python2_and_3_compatible_string(channel['name'])))
alert_channels = get_all_alert_channels_in_grafana() alert_channels = get_all_alert_channels_in_grafana()
......
...@@ -34,8 +34,8 @@ def save_dashboard_setting(dashboard_name, file_name, dashboard_settings): ...@@ -34,8 +34,8 @@ def save_dashboard_setting(dashboard_name, file_name, dashboard_settings):
def get_indivisual_dashboard_setting_and_save(dashboards): def get_indivisual_dashboard_setting_and_save(dashboards):
file_path = folder_path + '/' + log_file file_path = folder_path + '/' + log_file
with open(u"{0}".format(file_path) , 'w+') as f: if dashboards:
if dashboards: with open(u"{0}".format(file_path) , 'w') as f:
for board in dashboards: for board in dashboards:
(status, content) = get_dashboard(board['uri']) (status, content) = get_dashboard(board['uri'])
if status == 200: if status == 200:
......
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