Skip to content

Commit

Permalink
open yaml when loading
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCloudSec committed Nov 28, 2024
1 parent eccb91f commit 2c17518
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions prowler/providers/kubernetes/kubernetes_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,7 @@ def setup_session(
logger.info(
f"kubeconfig content: {type(kubeconfig_content)}{kubeconfig_content}"
)
if "\n" not in kubeconfig_content and ":" in kubeconfig_content:
# Try to reformat it as YAML by inserting line breaks
kubeconfig_content = kubeconfig_content.replace(
" ", "\n "
).replace(":", ":\n")
config_data = safe_load(kubeconfig_content)
config_data = safe_load(open(kubeconfig_content))
logger.info(f"config_data: {type(config_data)}{config_data}")
config.load_kube_config_from_dict(config_data, context=context)
if context:
Expand Down

0 comments on commit 2c17518

Please sign in to comment.