mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 17:23:15 -05:00
Fix HDFS support for CU5+ BDC instances (#10577)
* Fix HDFS node auth for non-root username * more changes
This commit is contained in:
@@ -76,6 +76,12 @@ export class SqlClusterConnection {
|
||||
return authType && authType.toLowerCase() === constants.integratedAuth;
|
||||
}
|
||||
|
||||
public updateUsername(username: string): void {
|
||||
if (username) {
|
||||
this._user = username;
|
||||
}
|
||||
}
|
||||
|
||||
public updatePassword(password: string): void {
|
||||
if (password) {
|
||||
this._password = password;
|
||||
|
||||
@@ -117,10 +117,19 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
|
||||
// Only child returned when failure happens : When failed with 'Unauthorized' error, prompt for password.
|
||||
if (children.length === 1 && this.hasExpansionError(children)) {
|
||||
if (children[0].errorStatusCode === 401) {
|
||||
//Prompt for password
|
||||
let password: string = await this.promptPassword(localize('prmptPwd', "Please provide the password to connect to HDFS:"));
|
||||
if (password && password.length > 0) {
|
||||
session.sqlClusterConnection.updatePassword(password);
|
||||
// First prompt for username (defaulting to existing username)
|
||||
let username: string = await this.promptInput(localize('promptUsername', "Please provide the username to connect to HDFS:"), session.sqlClusterConnection.user);
|
||||
// Only update the username if it's different than the original (the update functions ignore falsy values)
|
||||
if (username === session.sqlClusterConnection.user) {
|
||||
username = '';
|
||||
}
|
||||
session.sqlClusterConnection.updateUsername(username);
|
||||
|
||||
// And then prompt for password
|
||||
const password: string = await this.promptPassword(localize('prmptPwd', "Please provide the password to connect to HDFS:"));
|
||||
session.sqlClusterConnection.updatePassword(password);
|
||||
|
||||
if (username || password) {
|
||||
await node.updateFileSource(session.sqlClusterConnection);
|
||||
children = await node.getChildren(true);
|
||||
}
|
||||
@@ -141,6 +150,15 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
|
||||
this.expandCompleteEmitter.fire(expandResult);
|
||||
}
|
||||
|
||||
private async promptInput(promptMsg: string, defaultValue: string): Promise<string> {
|
||||
return await this.prompter.promptSingle(<IQuestion>{
|
||||
type: QuestionTypes.input,
|
||||
name: 'inputPrompt',
|
||||
message: promptMsg,
|
||||
default: defaultValue
|
||||
}).then(confirmed => <string>confirmed);
|
||||
}
|
||||
|
||||
private async promptPassword(promptMsg: string): Promise<string> {
|
||||
return await this.prompter.promptSingle(<IQuestion>{
|
||||
type: QuestionTypes.password,
|
||||
|
||||
Reference in New Issue
Block a user