Skip to content

Commit

Permalink
Merge pull request #481 from camptocamp/fix
Browse files Browse the repository at this point in the history
Audit: No error on printing Poetry version
  • Loading branch information
sbrunner authored Aug 9, 2024
2 parents 36c8326 + 41b4598 commit 8607e43
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 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
2 changes: 1 addition & 1 deletion github_app_geo_project/module/standard/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_actions(self, context: module.GetActionContext) -> list[module.Action[di
context.event_data.get("action") == "completed"
and context.event_data.get("workflow_run", {}).get("conclusion") == "failure"
# Don't run on dynamic workflows like CodeQL
and context.event_data.get("workflow", {}).get("path", {}).startswith("dynamic/")
and not context.event_data.get("workflow", {}).get("path", {}).startswith("dynamic/")
):
return [module.Action(priority=module.PRIORITY_STANDARD, data={})]
return []
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])
return None, False, AnsiProcessMessage(command, None, "", "", str(exception))


Expand Down

0 comments on commit 8607e43

Please sign in to comment.