lint: reformat python code with black
This commit is contained in:
parent
331beb01b4
commit
a406a7974b
88 changed files with 2579 additions and 1608 deletions
|
@ -16,20 +16,19 @@ class AlarmProxyAzureCdnAutomation(BaseAutomation):
|
|||
|
||||
def automate(self, full: bool = False) -> Tuple[bool, str]:
|
||||
credential = ClientSecretCredential(
|
||||
tenant_id=app.config['AZURE_TENANT_ID'],
|
||||
client_id=app.config['AZURE_CLIENT_ID'],
|
||||
client_secret=app.config['AZURE_CLIENT_SECRET'])
|
||||
client = AlertsManagementClient(
|
||||
credential,
|
||||
app.config['AZURE_SUBSCRIPTION_ID']
|
||||
tenant_id=app.config["AZURE_TENANT_ID"],
|
||||
client_id=app.config["AZURE_CLIENT_ID"],
|
||||
client_secret=app.config["AZURE_CLIENT_SECRET"],
|
||||
)
|
||||
firing = [x.name[len("bandwidth-out-high-bc-"):]
|
||||
for x in client.alerts.get_all()
|
||||
if x.name.startswith("bandwidth-out-high-bc-")
|
||||
and x.properties.essentials.monitor_condition == "Fired"]
|
||||
client = AlertsManagementClient(credential, app.config["AZURE_SUBSCRIPTION_ID"])
|
||||
firing = [
|
||||
x.name[len("bandwidth-out-high-bc-") :]
|
||||
for x in client.alerts.get_all()
|
||||
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.is_(None)
|
||||
Proxy.provider == "azure_cdn", Proxy.destroyed.is_(None)
|
||||
):
|
||||
alarm = get_or_create_alarm(proxy.brn, "bandwidth-out-high")
|
||||
if proxy.origin.group.group_name.lower() not in firing:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue