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

[BUG] Installation._unmarshal initializes databricks.sdk.core.Config when the value is None #169

Closed
JCZuurmond opened this issue Nov 11, 2024 · 0 comments · Fixed by #170
Assignees
Labels
bug Something isn't working

Comments

@JCZuurmond
Copy link
Member

JCZuurmond commented Nov 11, 2024

Description

The following code initiliatizes a databricks.sdk.core.Config when the value inst is None

if type_ref == databricks.sdk.core.Config:
if not inst:
inst = {}
return databricks.sdk.core.Config(**inst) # type: ignore[return-value]

This causes a bug in UCX when we load and save the WorkspaceConfig as that data classes has a databricks.sdk.core.Config attribute which is by default None and after loading it became databricks.sdk.core.Config(**{}). This field causes issues when it the config is used by our RuntimeContext which expects a different config than our cli context.

Reproduce

workspace_context: WorkspaceContext  # Created by the Databricks cli
config = workspace_context.installation.load(WorkspaceConfig)
workspace_context.installation.save(config)
@nfx nfx added the bug Something isn't working label Nov 12, 2024
@nfx nfx closed this as completed in #170 Nov 14, 2024
nfx added a commit that referenced this issue Nov 14, 2024
…stallation config files (#170)

closes #169

---------

Co-authored-by: Serge Smertin <serge.smertin@databricks.com>
nfx added a commit that referenced this issue Nov 14, 2024
* Fixed issue when Databricks SDK config objects were overridden for installation config files ([#170](#170)). This commit addresses an issue where Databricks SDK config objects were being overridden during installation config files creation, which has been resolved by modifying the `_marshal` method in the `installation` class to handle `databricks.sdk.core.Config` instances more carefully, and by introducing a new helper function `get_databricks_sdk_config` in the `paths.py` file, which retrieves the Databricks SDK configuration and improves the reliability and robustness of the SDK configuration. This fixes bug [#169](#169) and ensures that the SDK configuration is not accidentally modified during the installation process, preventing unexpected behavior and errors. The changes are isolated to the `paths.py` file and do not affect other parts of the codebase.
@nfx nfx mentioned this issue Nov 14, 2024
nfx added a commit that referenced this issue Nov 14, 2024
* Fixed issue when Databricks SDK config objects were overridden for
installation config files
([#170](#170)). This
commit addresses an issue where Databricks SDK config objects were being
overridden during installation config files creation, which has been
resolved by modifying the `_marshal` method in the `installation` class
to handle `databricks.sdk.core.Config` instances more carefully, and by
introducing a new helper function `get_databricks_sdk_config` in the
`paths.py` file, which retrieves the Databricks SDK configuration and
improves the reliability and robustness of the SDK configuration. This
fixes bug [#169](#169)
and ensures that the SDK configuration is not accidentally modified
during the installation process, preventing unexpected behavior and
errors. The changes are isolated to the `paths.py` file and do not
affect other parts of the codebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants