Skip to content

Commit b81bea1

Browse files
authored
Handle not parsing config in cli (#3331)
Ran into this locally, might be a locally corrupted config
1 parent 8714da2 commit b81bea1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/databricks/labs/ucx/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import webbrowser
55
from pathlib import Path
6+
from configparser import ParsingError
67

78
from databricks.labs.blueprint.cli import App
89
from databricks.labs.blueprint.entrypoint import get_logger
@@ -34,7 +35,11 @@ def _get_workspace_contexts(
3435
) -> list[WorkspaceContext]:
3536
"""Get workspace contexts to the workspaces for which the user has access"""
3637
if not a:
37-
a = AccountClient(product='ucx', product_version=__version__)
38+
try:
39+
a = AccountClient(product='ucx', product_version=__version__)
40+
except ParsingError as e:
41+
logger.error("Could not create account client", exc_info=e)
42+
return []
3843
account_installer = AccountInstaller(a)
3944
workspace_contexts = account_installer.get_workspace_contexts(w, run_as_collection, **named_parameters)
4045
return workspace_contexts

0 commit comments

Comments
 (0)