Skip to content

Commit a957b5e

Browse files
Fix "az" on Windows (#318)
and minor improvements to the configuration wizard Co-authored-by: Kartik Gupta <88345179+kartikgupta-db@users.noreply.github.com>
1 parent a2e5ebf commit a957b5e

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

packages/databricks-sdk-js/src/auth/fromAzureCli.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ export const fromAzureCli = (host?: URL): CredentialProvider => {
2929
return refreshableCredentialProvider(async () => {
3030
let stdout = "";
3131
try {
32-
({stdout} = await execFile("az", [
33-
"account",
34-
"get-access-token",
35-
"--resource",
36-
azureDatabricksLoginAppID,
37-
]));
32+
({stdout} = await execFile(
33+
"az",
34+
[
35+
"account",
36+
"get-access-token",
37+
"--resource",
38+
azureDatabricksLoginAppID,
39+
],
40+
{shell: true}
41+
));
3842
} catch (e: any) {
3943
if (e.code === "ENOENT") {
4044
throw new CredentialsProviderError(

packages/databricks-vscode/src/configuration/AzureCliCheck.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ export class AzureCliCheck implements Disposable {
182182
// check if Azure CLI is installed
183183
public async hasAzureCli(): Promise<boolean> {
184184
try {
185-
const {stdout} = await execFile(this.azBinPath, ["--version"]);
185+
const {stdout} = await execFile(this.azBinPath, ["--version"], {
186+
shell: true,
187+
});
186188
if (stdout.indexOf("azure-cli") !== -1) {
187189
return true;
188190
}
@@ -213,10 +215,11 @@ export class AzureCliCheck implements Disposable {
213215
// check if Azure CLI is logged in
214216
public async isAzureCliLoggedIn(): Promise<boolean> {
215217
try {
216-
const {stdout, stderr} = await execFile(this.azBinPath, [
217-
"account",
218-
"list",
219-
]);
218+
const {stdout, stderr} = await execFile(
219+
this.azBinPath,
220+
["account", "list"],
221+
{shell: true}
222+
);
220223
if (stdout === "[]") {
221224
return false;
222225
}

packages/databricks-vscode/src/configuration/ConnectionManager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ export class ConnectionManager {
238238
let config: ProjectConfig | undefined;
239239
while (true) {
240240
config = await configureWorkspaceWizard(
241-
config?.authProvider?.host.toString()
241+
this.databricksWorkspace?.host?.toString() ||
242+
config?.authProvider?.host.toString() ||
243+
process.env.DATABRICKS_HOST
242244
);
243245

244246
if (!config) {

packages/databricks-vscode/src/test/e2e/configure.e2e.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ describe("Configure Databricks Extension", async function () {
7373
let input = await new InputBox(workbench.locatorMap).wait();
7474
await sleep(200);
7575

76-
await input.setText(host);
77-
await sleep(500);
7876
await input.confirm();
7977
await sleep(200);
8078

packages/databricks-vscode/src/ui/wizard.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export class MultiStepInput {
163163
input.totalSteps = totalSteps;
164164
input.value = value || "";
165165
input.prompt = prompt;
166+
input.ignoreFocusOut = true;
166167
input.buttons = [
167168
...(this.steps.length > 1 ? [QuickInputButtons.Back] : []),
168169
...(buttons || []),

0 commit comments

Comments
 (0)