Merge pull request #1700 from SkynetLabs/ivo/fewer-non-actionable-alerts

Fewer non-actionable alerts
This commit is contained in:
Matthew Sevey 2022-02-11 10:21:44 -05:00 committed by GitHub
commit 5feee8f611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -39,6 +39,16 @@ def exec(command):
async def block_skylinks_from_airtable():
# Get nginx's IP before doing anything else. If this step fails we don't
# need to continue with the execution of the script.
ipaddress = exec(
"docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nginx"
)
if ipaddress == "":
print("Nginx's IP could not be detected. Exiting.")
return
print("Pulling blocked skylinks from Airtable via api integration")
headers = {"Authorization": "Bearer " + AIRTABLE_API_KEY}
skylinks = []
@ -122,10 +132,6 @@ async def block_skylinks_from_airtable():
)
await send_msg(message, file=("\n".join(invalid_skylinks)))
ipaddress = exec(
"docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nginx"
)
print("Sending blocklist request to siad through nginx")
response = requests.post(
"http://" + ipaddress + ":8000/skynet/blocklist",