Skip to content

Commit

Permalink
Audit: No error on printing Poetry version
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 9, 2024
1 parent 60f1dd2 commit 65f8ad3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions github_app_geo_project/module/audit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ async def _snyk_fix(
"Poetry version",
"Error while getting the Poetry version",
"Timeout while getting the Poetry version",
error=False,
)

snyk_fix_success = True
Expand Down
12 changes: 10 additions & 2 deletions github_app_geo_project/module/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ async def run_timeout(
error_message: str,
timeout_message: str,
cwd: str | None = None,
error: bool = True,
) -> tuple[str | None, bool, Message | None]:
"""
Run a command with a timeout.
Expand All @@ -493,6 +494,7 @@ async def run_timeout(
error_message: The message on error
timeout_message: The message on timeout
cwd: The working directory
error: Set to false to don't get error log (silent mode)
Return:
------
Expand Down Expand Up @@ -535,7 +537,10 @@ async def run_timeout(
_LOGGER.warning(message)
return stdout.decode(), success, message
except FileNotFoundError as exception:
_LOGGER.exception("%s not found: %s", command[0], exception)
if error:
_LOGGER.exception("%s not found: %s", command[0], exception)
else:
_LOGGER.warning("%s not found")
proc = subprocess.run( # nosec # pylint: disable=subprocess-run-check
["find", "/", "-name", command[0]],
capture_output=True,
Expand All @@ -560,7 +565,10 @@ async def run_timeout(
_LOGGER.warning(message)
return None, False, message
else:
_LOGGER.exception("TimeoutError: %s", exception)
if error:
_LOGGER.exception("TimeoutError for %s: %s", command[0], exception)
else:
_LOGGER.warning("TimeoutError for %s", command[0], exception)
return None, False, AnsiProcessMessage(command, None, "", "", str(exception))


Expand Down

0 comments on commit 65f8ad3

Please sign in to comment.