Skip to content

Commit f951aac

Browse files
Fixed installer not opening config file during the installation (#945)
## Changes `self._installation.save(config)` returns a local path from the workspace. Changed the installer to build an URL that can be resolved by webbrowser.open() ### Linked issues fixes #944 ### Functionality ### Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [X ] manually tested - [X ] added unit tests
1 parent b8a0535 commit f951aac

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/databricks/labs/ucx/install.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,9 @@ def warehouse_type(_):
265265
spark_conf=spark_conf_dict,
266266
policy_id=policy_id,
267267
)
268-
ws_file_url = self._installation.save(config)
269-
if self._prompts.confirm("Open config file in the browser and continue installing?"):
268+
self._installation.save(config)
269+
ws_file_url = self._installation.workspace_link(config.__file__)
270+
if self._prompts.confirm(f"Open config file in the browser and continue installing? {ws_file_url}"):
270271
webbrowser.open(ws_file_url)
271272
return config
272273

tests/unit/test_install.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,3 +1217,21 @@ def test_latest_job_status_exception(ws, mock_installation_with_jobs, any_prompt
12171217
ws.jobs.list_runs.side_effect = InvalidParameterValue("Workflow does not exists")
12181218
status = workspace_installation.latest_job_status()
12191219
assert len(status) == 0
1220+
1221+
1222+
def test_open_config(ws, mocker, mock_installation):
1223+
webbrowser_open = mocker.patch("webbrowser.open")
1224+
prompts = MockPrompts(
1225+
{
1226+
r".*PRO or SERVERLESS SQL warehouse.*": "1",
1227+
r"Choose how to map the workspace groups.*": "2",
1228+
r".*workspace group names.*": "g1, g2, g99",
1229+
r"Open config file in.*": "yes",
1230+
r".*": "",
1231+
}
1232+
)
1233+
1234+
install = WorkspaceInstaller(prompts, mock_installation, ws)
1235+
install.configure()
1236+
1237+
webbrowser_open.assert_called_with('https://localhost/#workspace~/mock/config.yml')

0 commit comments

Comments
 (0)