Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit: No error on printing Poetry version #481

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading