ci: add flake8

This commit is contained in:
Iain Learmonth 2022-05-16 13:29:48 +01:00
parent 014596d271
commit dd501a6e4e
32 changed files with 170 additions and 171 deletions

View file

@ -28,11 +28,11 @@ class AlarmProxyAzureCdnAutomation(BaseAutomation):
if x.name.startswith("bandwidth-out-high-bc-") and x.properties.essentials.monitor_condition == "Fired"]
for proxy in Proxy.query.filter(
Proxy.provider == "azure_cdn",
Proxy.destroyed == None
Proxy.destroyed.is_(None)
):
alarm = get_proxy_alarm(proxy.id, "bandwidth-out-high")
if proxy.origin.group.group_name.lower() not in firing:
alarm.update_state(AlarmState.OK, "Azure monitor alert not firing")
else:
alarm.update_state(AlarmState.CRITICAL, "Azure monitor alert firing")
return True, ""
return True, ""

View file

@ -47,7 +47,7 @@ class AlarmProxyCloudfrontAutomation(BaseAutomation):
db.session.add(alarm)
alarm.last_updated = datetime.datetime.utcnow()
deployed_count = len(Proxy.query.filter(
Proxy.destroyed == None).all())
Proxy.destroyed.is_(None)).all())
old_state = alarm.alarm_state
if deployed_count > 370:
alarm.alarm_state = AlarmState.CRITICAL

View file

@ -29,7 +29,7 @@ class AlarmProxyHTTPStatusAutomation(BaseAutomation):
def automate(self, full: bool = False) -> Tuple[bool, str]:
proxies = Proxy.query.filter(
Proxy.destroyed == None
Proxy.destroyed.is_(None)
)
for proxy in proxies:
try: