Fix pre-commit/lint

This commit is contained in:
Twangboy 2023-04-04 10:14:19 -06:00 committed by Pedro Algarvio
parent 4cc0388850
commit be7dd894d8
4 changed files with 16 additions and 10 deletions

View file

@ -44,4 +44,3 @@ jobs:
VIRUSTOTAL_API_KEY: ${{ secrets.VIRUSTOTAL_API_KEY }}
run: |
tools release upload-virustotal ${{ needs.prepare-workflow.outputs.salt-version }}

View file

@ -41,7 +41,9 @@ python-tools-scripts==0.12.0
pyyaml==6.0
# via -r requirements/static/ci/tools.in
requests==2.28.2
# via python-tools-scripts
# via
# python-tools-scripts
# virustotal3
rich==12.5.1
# via python-tools-scripts
s3transfer==0.5.2
@ -54,3 +56,5 @@ urllib3==1.26.12
# via
# botocore
# requests
virustotal3==1.0.8
# via -r requirements/static/ci/tools.in

View file

@ -41,7 +41,9 @@ python-tools-scripts==0.12.0
pyyaml==6.0
# via -r requirements/static/ci/tools.in
requests==2.28.2
# via python-tools-scripts
# via
# python-tools-scripts
# virustotal3
rich==12.5.1
# via python-tools-scripts
s3transfer==0.5.2
@ -54,3 +56,5 @@ urllib3==1.26.12
# via
# botocore
# requests
virustotal3==1.0.8
# via -r requirements/static/ci/tools.in

View file

@ -6,13 +6,13 @@ from __future__ import annotations
import json
import logging
import pathlib
import os
import pathlib
import sys
import tempfile
import time
import virustotal3.core
import virustotal3.core
from ptscripts import Context, command_group
import tools.utils
@ -201,10 +201,7 @@ def upload_virustotal(ctx: Context, salt_version: str):
ctx.error(f"Could not find {download_file} in bucket.")
ctx.exit(1)
if exc.response["Error"]["Code"] == "400":
pass
ctx.error(
f"Could not download {download_file} from bucket: {exc}"
)
ctx.error(f"Could not download {download_file} from bucket: {exc}")
ctx.exit(1)
log.exception(f"Error downloading {download_file}: {exc}")
ctx.exit(1)
@ -212,7 +209,9 @@ def upload_virustotal(ctx: Context, salt_version: str):
# API key should be an environment variable
api_key = os.environ.get("VIRUSTOTAL_API_KEY")
ctx.info(f"Uploading to VirusTotal: {os.path.basename(local_download_file)}")
ctx.info(
f"Uploading to VirusTotal: {os.path.basename(local_download_file)}"
)
vt = virustotal3.core.Files(api_key)
response = vt.upload(local_download_file)