Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python linter error - Part 9 #339

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions monasca-alarms/monasca_alarm_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _process_notification(self, notification, notification_ids):

self._print_message('Deleting notification "{}"'.format(name))

# TODO Delete could be tricky if this notification is used by alarm definitions
# TODO(craigbr) Delete could be tricky if this notification is used by alarm definitions
resp = self._monasca.notifications.delete(notification_id=notifications[name]['id'])
if resp.status_code == 204:
self._print_message('Successfully deleted notification "{}"'.format(name))
Expand All @@ -230,8 +230,8 @@ def _process_notification(self, notification, notification_ids):
matches = True
for field in fields:
if existing[field] != def_kwargs[field]:
self._print_message('Notification "{}": Field {} value "{}" does not match expected "{}"'.format(
name, field, existing[field], def_kwargs[field]))
self._print_message('Notification "{}": Field {} value "{}" does not match expected "{}"'
.format(name, field, existing[field], def_kwargs[field]))
matches = False
if matches:
self._print_message('Notification "{}" has no changes'.format(name))
Expand Down Expand Up @@ -299,7 +299,8 @@ def _process_alarm_definition(self, definition, notification_ids):
ok_actions = self._map_notifications(definition.get('ok_actions', []), notification_ids)
undetermined_actions = self._map_notifications(definition.get('undetermined_actions', []), notification_ids)
def_kwargs = {'name': name, 'description': definition.get('description', ''), 'expression': expression,
'match_by': definition.get('match_by', []), 'severity': definition.get('severity', 'LOW').upper(),
'match_by': definition.get('match_by', []),
'severity': definition.get('severity', 'LOW').upper(),
'alarm_actions': alarm_actions, 'ok_actions': ok_actions,
'undetermined_actions': undetermined_actions}

Expand All @@ -309,12 +310,13 @@ def _process_alarm_definition(self, definition, notification_ids):
existing['alarm_actions'].sort()
existing['ok_actions'].sort()
existing['undetermined_actions'].sort()
fields = ['name', 'description', 'expression', 'match_by', 'severity', 'alarm_actions', 'ok_actions', 'undetermined_actions']
fields = ['name', 'description', 'expression', 'match_by', 'severity',
'alarm_actions', 'ok_actions', 'undetermined_actions']
matches = True
for field in fields:
if existing[field] != def_kwargs[field]:
self._print_message('Alarm Definition "{}": Field {} value "{}" does not match expected "{}"'.format(
name, field, existing[field], def_kwargs[field]))
self._print_message('Alarm Definition "{}": Field {} value "{}" does not match expected "{}"'
.format(name, field, existing[field], def_kwargs[field]))
matches = False
if matches:
self._print_message('Alarm Definition "{}" has no changes'.format(name))
Expand Down
1 change: 1 addition & 0 deletions monasca-thresh/kafka_wait_for_topics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# coding=utf-8

# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
#
Expand Down