Add support for new endpoint key string 'gateway' (#4954)

This commit is contained in:
Gene Lee
2019-04-09 15:19:02 -07:00
committed by GitHub
parent ea8f885f05
commit b3be1d79cd
4 changed files with 16 additions and 5 deletions

View File

@@ -13,7 +13,8 @@ export const extensionConfigSectionName = 'mssql';
// DATA PROTOCOL VALUES ///////////////////////////////////////////////////////////
export const mssqlClusterProviderName = 'mssqlCluster';
export const hadoopKnoxEndpointName = 'Knox';
export const hadoopEndpointNameKnox = 'Knox';
export const hadoopEndpointNameGateway = 'gateway';
export const protocolVersion = '1.0';
export const hostPropName = 'host';
export const userPropName = 'user';

View File

@@ -79,7 +79,11 @@ async function createSqlClusterConnInfo(sqlConnInfo: azdata.IConnectionProfile |
let endpoints: IEndpoint[] = serverInfo.options[constants.clusterEndpointsProperty];
if (!endpoints || endpoints.length === 0) { return undefined; }
let index = endpoints.findIndex(ep => ep.serviceName === constants.hadoopKnoxEndpointName);
let index = endpoints.findIndex(ep => {
let serviceName: string = ep.serviceName.toLowerCase();
return serviceName === constants.hadoopEndpointNameKnox.toLowerCase() ||
serviceName === constants.hadoopEndpointNameGateway.toLowerCase();
});
if (index < 0) { return undefined; }
let credentials = await azdata.connection.getCredentials(connectionId);

View File

@@ -57,7 +57,8 @@ const configBase = {
const KNOX_ENDPOINT_SERVER = 'host';
const KNOX_ENDPOINT_PORT = 'knoxport';
const KNOX_ENDPOINT = 'knox';
const KNOX_ENDPOINT_KNOX = 'knox';
const KNOX_ENDPOINT_GATEWAY = 'gateway';
const SQL_PROVIDER = 'MSSQL';
const USER = 'user';
const DEFAULT_CLUSTER_USER_NAME = 'root';
@@ -242,7 +243,9 @@ export class JupyterSession implements nb.ISession {
//Update server info with bigdata endpoint - Unified Connection
if (connection.providerName === SQL_PROVIDER) {
let clusterEndpoint: utils.IEndpoint = await this.getClusterEndpoint(connection.id, KNOX_ENDPOINT);
let clusterEndpoint: utils.IEndpoint =
await this.getClusterEndpoint(connection.id, KNOX_ENDPOINT_KNOX) ||
await this.getClusterEndpoint(connection.id, KNOX_ENDPOINT_GATEWAY);
if (!clusterEndpoint) {
let kernelDisplayName: string = await this.getKernelDisplayName();
return Promise.reject(new Error(localize('connectionNotValid', 'Spark kernels require a connection to a SQL Server big data cluster master instance.')));

View File

@@ -481,7 +481,10 @@ export class CellModel implements ICellModel {
if (serverInfo && serverInfo.options && serverInfo.options['clusterEndpoints']) {
let endpoints: notebookUtils.IEndpoint[] = serverInfo.options['clusterEndpoints'];
if (endpoints && endpoints.length > 0) {
endpoint = endpoints.find(ep => ep.serviceName.toLowerCase() === 'knox');
endpoint = endpoints.find(ep => {
let serviceName: string = ep.serviceName.toLowerCase();
return serviceName === 'knox' || serviceName === 'gateway';
});
}
}
}