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

fix(k8s): do not raise error when unable to list roles #5630

Merged
merged 1 commit into from
Nov 4, 2024
Merged
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
6 changes: 2 additions & 4 deletions prowler/providers/kubernetes/kubernetes_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,17 +366,15 @@
logger.info("Context user roles retrieved successfully.")
return roles
except ApiException as api_error:
logger.critical(
logger.error(

Check warning on line 369 in prowler/providers/kubernetes/kubernetes_provider.py

View check run for this annotation

Codecov / codecov/patch

prowler/providers/kubernetes/kubernetes_provider.py#L369

Added line #L369 was not covered by tests
f"ApiException[{api_error.__traceback__.tb_lineno}]: {api_error}"
)
raise KubernetesAPIError(original_exception=api_error)
except KubernetesError as error:
raise error
except Exception as error:
logger.critical(
logger.error(

Check warning on line 375 in prowler/providers/kubernetes/kubernetes_provider.py

View check run for this annotation

Codecov / codecov/patch

prowler/providers/kubernetes/kubernetes_provider.py#L375

Added line #L375 was not covered by tests
f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
)
raise KubernetesError(original_exception=error)

def get_all_namespaces(self) -> list[str]:
"""
Expand Down