Add config for ignoring SSL errors on BDC queries (#8169)

* Add config for ignoring SSL errors on BDC queries

* Fix error handling in write stream

* Disable tslint check

* Handle promise appropriately

* PR comments

* Change defaults to true
This commit is contained in:
Charles Gagnon
2019-11-01 15:20:47 -07:00
committed by GitHub
parent 08d81927b4
commit abbb1e54da
16 changed files with 100 additions and 46 deletions

View File

@@ -11,7 +11,6 @@
"url": "",
"auth": "None"
},
"ignore_ssl_errors": true,
"livy_session_startup_timeout_seconds": 100,
"logging_config": {
"version": 1,

View File

@@ -246,3 +246,19 @@ export async function exists(path: string): Promise<boolean> {
return false;
}
}
const bdcConfigSectionName = 'bigDataCluster';
const ignoreSslConfigName = 'ignoreSslVerification';
/**
* Retrieves the current setting for whether to ignore SSL verification errors
*/
export function getIgnoreSslVerificationConfigSetting(): boolean {
try {
const config = vscode.workspace.getConfiguration(bdcConfigSectionName);
return config.get<boolean>(ignoreSslConfigName) || true;
} catch (error) {
console.error(`Unexpected error retrieving ${bdcConfigSectionName}.${ignoreSslConfigName} setting : ${error}`);
}
return true;
}

View File

@@ -26,10 +26,6 @@ const configBase = {
'kernel_r_credentials': {
'url': ''
},
'ignore_ssl_errors': true,
'livy_session_startup_timeout_seconds': 100,
'logging_config': {
'version': 1,
'formatters': {
@@ -172,7 +168,12 @@ export class JupyterSession implements nb.ISession {
private _messagesComplete: Deferred<void> = new Deferred<void>();
constructor(private sessionImpl: Session.ISession, skipSettingEnvironmentVars?: boolean, private _pythonEnvVarPath?: string) {
this.setEnvironmentVars(skipSettingEnvironmentVars);
this.setEnvironmentVars(skipSettingEnvironmentVars).catch(error => {
console.error(`Unexpected exception setting Jupyter Session variables : ${error}`);
// We don't want callers to hang forever waiting - it's better to continue on even if we weren't
// able to set environment variables
this._messagesComplete.resolve();
});
}
public get canChangeKernels(): boolean {
@@ -309,6 +310,7 @@ export class JupyterSession implements nb.ISession {
config.kernel_scala_credentials = creds;
config.kernel_r_credentials = creds;
config.logging_config.handlers.magicsHandler.home_path = homePath;
config.ignore_ssl_errors = utils.getIgnoreSslVerificationConfigSetting();
}
private getKnoxPortOrDefault(connectionProfile: IConnectionProfile): string {