fix(gcp): improve logging messages (#3185)

This commit is contained in:
Sergio Garcia
2023-12-12 12:38:50 +01:00
committed by GitHub
parent 0f165f0bf0
commit 3c3dfb380b
2 changed files with 5 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import os
import sys
from colorama import Fore, Style
from google import auth
from googleapiclient import discovery
@@ -89,4 +90,7 @@ class GCP_Provider:
logger.error(
f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
)
print(
f"\n{Fore.YELLOW}Cloud Resource Manager API {Style.RESET_ALL}has not been used before or it is disabled.\nEnable it by visiting https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/ then retry."
)
return []

View File

@@ -62,7 +62,7 @@ class GCPService:
project_ids.append(project_id)
else:
print(
f"\n{Fore.YELLOW}{self.service} API {Style.RESET_ALL}has not been used in project {project_id} before or it is disabled.\nEnable it by visiting https://console.developers.google.com/apis/api/dataproc.googleapis.com/overview?project={project_id} then retry."
f"\n{Fore.YELLOW}{self.service} API {Style.RESET_ALL}has not been used in project {project_id} before or it is disabled.\nEnable it by visiting https://console.developers.google.com/apis/api/{self.service}.googleapis.com/overview?project={project_id} then retry."
)
except Exception as error:
logger.error(