mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
cluster deploy extension: Add localization support and fix " to ' strings (#4332)
* Add localization support and fix " to ' strings
* Fix ${ usage
This commit is contained in:
@@ -7,9 +7,9 @@ import * as vscode from 'vscode';
|
|||||||
import { Host } from '../kubectl/host';
|
import { Host } from '../kubectl/host';
|
||||||
import { Shell, Platform } from '../utility/shell';
|
import { Shell, Platform } from '../utility/shell';
|
||||||
|
|
||||||
const EXTENSION_CONFIG_KEY = "mssql-bdc";
|
const EXTENSION_CONFIG_KEY = 'mssql-bdc';
|
||||||
const KUBECONFIG_PATH_KEY = "mssql-bdc.kubeconfig";
|
const KUBECONFIG_PATH_KEY = 'mssql-bdc.kubeconfig';
|
||||||
const KNOWN_KUBECONFIGS_KEY = "mssql-bdc.knownKubeconfigs";
|
const KNOWN_KUBECONFIGS_KEY = 'mssql-bdc.knownKubeconfigs';
|
||||||
|
|
||||||
export async function addPathToConfig(configKey: string, value: string): Promise<void> {
|
export async function addPathToConfig(configKey: string, value: string): Promise<void> {
|
||||||
await setConfigValue(configKey, value);
|
await setConfigValue(configKey, value);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function ensureDownloadFunc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function toTempFile(sourceUrl: string): Promise<Errorable<string>> {
|
export async function toTempFile(sourceUrl: string): Promise<Errorable<string>> {
|
||||||
const tempFileObj = tmp.fileSync({ prefix: "mssql-bdc-autoinstall-" });
|
const tempFileObj = tmp.fileSync({ prefix: 'mssql-bdc-autoinstall-' });
|
||||||
const downloadResult = await to(sourceUrl, tempFileObj.name);
|
const downloadResult = await to(sourceUrl, tempFileObj.name);
|
||||||
if (succeeded(downloadResult)) {
|
if (succeeded(downloadResult)) {
|
||||||
return { succeeded: true, result: tempFileObj.name };
|
return { succeeded: true, result: tempFileObj.name };
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import * as download from './download';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import mkdirp = require('mkdirp');
|
import mkdirp = require('mkdirp');
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as nls from 'vscode-nls';
|
||||||
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { Shell, Platform } from '../utility/shell';
|
import { Shell, Platform } from '../utility/shell';
|
||||||
import { Errorable, failed } from '../interfaces';
|
import { Errorable, failed } from '../interfaces';
|
||||||
import { addPathToConfig, toolPathBaseKey } from '../config/config';
|
import { addPathToConfig, toolPathBaseKey } from '../config/config';
|
||||||
@@ -29,7 +32,7 @@ export async function installKubectl(shell: Shell): Promise<Errorable<null>> {
|
|||||||
const downloadFile = path.join(installFolder, binFile);
|
const downloadFile = path.join(installFolder, binFile);
|
||||||
const downloadResult = await download.to(kubectlUrl, downloadFile);
|
const downloadResult = await download.to(kubectlUrl, downloadFile);
|
||||||
if (failed(downloadResult)) {
|
if (failed(downloadResult)) {
|
||||||
return { succeeded: false, error: [`Failed to download kubectl: ${downloadResult.error[0]}`] };
|
return { succeeded: false, error: [localize('downloadKubectlFailed', 'Failed to download kubectl: {0}', downloadResult.error[0])] };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shell.isUnix()) {
|
if (shell.isUnix()) {
|
||||||
@@ -43,7 +46,7 @@ export async function installKubectl(shell: Shell): Promise<Errorable<null>> {
|
|||||||
async function getStableKubectlVersion(): Promise<Errorable<string>> {
|
async function getStableKubectlVersion(): Promise<Errorable<string>> {
|
||||||
const downloadResult = await download.toTempFile('https://storage.googleapis.com/kubernetes-release/release/stable.txt');
|
const downloadResult = await download.toTempFile('https://storage.googleapis.com/kubernetes-release/release/stable.txt');
|
||||||
if (failed(downloadResult)) {
|
if (failed(downloadResult)) {
|
||||||
return { succeeded: false, error: [`Failed to establish kubectl stable version: ${downloadResult.error[0]}`] };
|
return { succeeded: false, error: [localize('kubectlVersionCheckFailed', 'Failed to establish kubectl stable version: {0}', downloadResult.error[0])] };
|
||||||
}
|
}
|
||||||
const version = fs.readFileSync(downloadResult.result, 'utf-8');
|
const version = fs.readFileSync(downloadResult.result, 'utf-8');
|
||||||
fs.unlinkSync(downloadResult.result);
|
fs.unlinkSync(downloadResult.result);
|
||||||
|
|||||||
@@ -3,14 +3,17 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as vscode from "vscode";
|
import * as vscode from 'vscode';
|
||||||
|
import * as nls from 'vscode-nls';
|
||||||
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
export interface ISqlServerBigDataClusterChannel {
|
export interface ISqlServerBigDataClusterChannel {
|
||||||
showOutput(message: any, title?: string): void;
|
showOutput(message: any, title?: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const outputChannelName = localize('bigDataClusterOutputChannel', 'SQL Server big data cluster');
|
||||||
class SqlServerBigDataCluster implements ISqlServerBigDataClusterChannel {
|
class SqlServerBigDataCluster implements ISqlServerBigDataClusterChannel {
|
||||||
private readonly channel: vscode.OutputChannel = vscode.window.createOutputChannel("SQL Server big data cluster");
|
private readonly channel: vscode.OutputChannel = vscode.window.createOutputChannel(outputChannelName);
|
||||||
|
|
||||||
showOutput(message: any, title?: string): void {
|
showOutput(message: any, title?: string): void {
|
||||||
if (title) {
|
if (title) {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as nls from 'vscode-nls';
|
||||||
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { Shell } from '../utility/shell';
|
import { Shell } from '../utility/shell';
|
||||||
import { Host } from './host';
|
import { Host } from './host';
|
||||||
import { FS } from '../utility/fs';
|
import { FS } from '../utility/fs';
|
||||||
@@ -53,17 +56,18 @@ export function execPath(shell: Shell, basePath: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CheckPresentFailureReason = 'inferFailed' | 'configuredFileMissing';
|
type CheckPresentFailureReason = 'inferFailed' | 'configuredFileMissing';
|
||||||
|
const installDependenciesAction = localize('installDependenciesAction','Install dependencies');
|
||||||
|
const learnMoreAction = localize('learnMoreAction','Learn more');
|
||||||
function alertNoBin(host: Host, binName: string, failureReason: CheckPresentFailureReason, message: string, installDependencies: () => void): void {
|
function alertNoBin(host: Host, binName: string, failureReason: CheckPresentFailureReason, message: string, installDependencies: () => void): void {
|
||||||
switch (failureReason) {
|
switch (failureReason) {
|
||||||
case 'inferFailed':
|
case 'inferFailed':
|
||||||
host.showErrorMessage(message, 'Install dependencies', 'Learn more').then(
|
host.showErrorMessage(message, installDependenciesAction, learnMoreAction).then(
|
||||||
(str) => {
|
(str) => {
|
||||||
switch (str) {
|
switch (str) {
|
||||||
case 'Learn more':
|
case learnMoreAction:
|
||||||
host.showInformationMessage(`Add ${binName} directory to path, or set "mssql-bdc.${binName}-path" config to ${binName} binary.`);
|
host.showInformationMessage(localize('moreInfoMsg', 'Add {0} directory to path, or set "mssql-bdc.{0}-path" config to {0} binary.', binName));
|
||||||
break;
|
break;
|
||||||
case 'Install dependencies':
|
case installDependenciesAction:
|
||||||
installDependencies();
|
installDependencies();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -72,9 +76,9 @@ function alertNoBin(host: Host, binName: string, failureReason: CheckPresentFail
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'configuredFileMissing':
|
case 'configuredFileMissing':
|
||||||
host.showErrorMessage(message, 'Install dependencies').then(
|
host.showErrorMessage(message, installDependenciesAction).then(
|
||||||
(str) => {
|
(str) => {
|
||||||
if (str === 'Install dependencies') {
|
if (str === installDependenciesAction) {
|
||||||
installDependencies();
|
installDependencies();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as nls from 'vscode-nls';
|
||||||
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { Host } from './host';
|
import { Host } from './host';
|
||||||
import { FS } from '../utility/fs';
|
import { FS } from '../utility/fs';
|
||||||
import { Shell, ShellResult } from '../utility/shell';
|
import { Shell, ShellResult } from '../utility/shell';
|
||||||
@@ -72,17 +75,17 @@ async function checkForKubectlInternal(context: Context, errorMessageMode: Check
|
|||||||
const bin = getToolPath(context.host, context.shell, binName);
|
const bin = getToolPath(context.host, context.shell, binName);
|
||||||
|
|
||||||
const contextMessage = getCheckKubectlContextMessage(errorMessageMode);
|
const contextMessage = getCheckKubectlContextMessage(errorMessageMode);
|
||||||
const inferFailedMessage = `Could not find "${binName}" binary.${contextMessage}`;
|
const inferFailedMessage = localize('binaryNotFound', 'Could not find {0} binary. {1}', binName, contextMessage);
|
||||||
const configuredFileMissingMessage = `${bin} is not installed. ${contextMessage}`;
|
const configuredFileMissingMessage = localize('binaryNotInstalled', '{0} is not installed. {1}', bin, contextMessage);
|
||||||
|
|
||||||
return await binutil.checkForBinary(context, bin, binName, inferFailedMessage, configuredFileMissingMessage, errorMessageMode !== CheckPresentMessageMode.Silent);
|
return await binutil.checkForBinary(context, bin, binName, inferFailedMessage, configuredFileMissingMessage, errorMessageMode !== CheckPresentMessageMode.Silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCheckKubectlContextMessage(errorMessageMode: CheckPresentMessageMode): string {
|
function getCheckKubectlContextMessage(errorMessageMode: CheckPresentMessageMode): string {
|
||||||
if (errorMessageMode === CheckPresentMessageMode.Activation) {
|
if (errorMessageMode === CheckPresentMessageMode.Activation) {
|
||||||
return ' SQL Server Big data cluster requires kubernetes.';
|
return localize('kubernetesRequired',' SQL Server Big data cluster requires kubernetes.');
|
||||||
} else if (errorMessageMode === CheckPresentMessageMode.Command) {
|
} else if (errorMessageMode === CheckPresentMessageMode.Command) {
|
||||||
return ' Cannot execute command.';
|
return localize('cannotExecuteCmd', ' Cannot execute command.');
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -111,7 +114,7 @@ async function checkPossibleIncompatibility(context: Context): Promise<void> {
|
|||||||
checkedCompatibility = true;
|
checkedCompatibility = true;
|
||||||
const compat = await compatibility.check((cmd) => asJson<compatibility.Version>(context, cmd));
|
const compat = await compatibility.check((cmd) => asJson<compatibility.Version>(context, cmd));
|
||||||
if (!compatibility.isGuaranteedCompatible(compat) && compat.didCheck) {
|
if (!compatibility.isGuaranteedCompatible(compat) && compat.didCheck) {
|
||||||
const versionAlert = `kubectl version ${compat.clientVersion} may be incompatible with cluster Kubernetes version ${compat.serverVersion}`;
|
const versionAlert = localize('kubectlVersionIncompatible', 'kubectl version ${0} may be incompatible with cluster Kubernetes version {1}', compat.clientVersion, compat.serverVersion);
|
||||||
context.host.showWarningMessage(versionAlert);
|
context.host.showWarningMessage(versionAlert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +131,7 @@ export function baseKubectlPath(context: Context): string {
|
|||||||
async function asJson<T>(context: Context, command: string): Promise<Errorable<T>> {
|
async function asJson<T>(context: Context, command: string): Promise<Errorable<T>> {
|
||||||
const shellResult = await invokeAsync(context, command);
|
const shellResult = await invokeAsync(context, command);
|
||||||
if (!shellResult) {
|
if (!shellResult) {
|
||||||
return { succeeded: false, error: [`Unable to run command (${command})`] };
|
return { succeeded: false, error: [localize('cannotRunCommand', 'Unable to run command ({0})', command)] };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shellResult.code === 0) {
|
if (shellResult.code === 0) {
|
||||||
|
|||||||
@@ -3,9 +3,12 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as vscode from "vscode";
|
import * as vscode from 'vscode';
|
||||||
import { Kubectl } from "./kubectl";
|
import * as nls from 'vscode-nls';
|
||||||
import { failed, ClusterType } from "../interfaces";
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
|
import { Kubectl } from './kubectl';
|
||||||
|
import { failed, ClusterType } from '../interfaces';
|
||||||
|
|
||||||
export interface KubectlContext {
|
export interface KubectlContext {
|
||||||
readonly clusterName: string;
|
readonly clusterName: string;
|
||||||
@@ -47,7 +50,7 @@ export interface ClusterConfig {
|
|||||||
|
|
||||||
|
|
||||||
async function getKubeconfig(kubectl: Kubectl): Promise<Kubeconfig | null> {
|
async function getKubeconfig(kubectl: Kubectl): Promise<Kubeconfig | null> {
|
||||||
const shellResult = await kubectl.asJson<any>("config view -o json");
|
const shellResult = await kubectl.asJson<any>('config view -o json');
|
||||||
if (failed(shellResult)) {
|
if (failed(shellResult)) {
|
||||||
vscode.window.showErrorMessage(shellResult.error[0]);
|
vscode.window.showErrorMessage(shellResult.error[0]);
|
||||||
return null;
|
return null;
|
||||||
@@ -60,11 +63,11 @@ export async function getCurrentClusterConfig(kubectl: Kubectl): Promise<Cluster
|
|||||||
if (!kubeConfig || !kubeConfig.clusters || !kubeConfig.contexts) {
|
if (!kubeConfig || !kubeConfig.clusters || !kubeConfig.contexts) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const contextConfig = kubeConfig.contexts.find((context) => context.name === kubeConfig["current-context"])!;
|
const contextConfig = kubeConfig.contexts.find((context) => context.name === kubeConfig['current-context'])!;
|
||||||
const clusterConfig = kubeConfig.clusters.find((cluster) => cluster.name === contextConfig.context.cluster)!;
|
const clusterConfig = kubeConfig.clusters.find((cluster) => cluster.name === contextConfig.context.cluster)!;
|
||||||
return {
|
return {
|
||||||
server: clusterConfig.cluster.server,
|
server: clusterConfig.cluster.server,
|
||||||
certificateAuthority: clusterConfig.cluster["certificate-authority"]
|
certificateAuthority: clusterConfig.cluster['certificate-authority']
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +76,7 @@ export async function getContexts(kubectl: Kubectl): Promise<KubectlContext[]> {
|
|||||||
if (!kubectlConfig) {
|
if (!kubectlConfig) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const currentContext = kubectlConfig["current-context"];
|
const currentContext = kubectlConfig['current-context'];
|
||||||
const contexts = kubectlConfig.contexts || [];
|
const contexts = kubectlConfig.contexts || [];
|
||||||
return contexts.map((c) => {
|
return contexts.map((c) => {
|
||||||
return {
|
return {
|
||||||
@@ -87,14 +90,15 @@ export async function getContexts(kubectl: Kubectl): Promise<KubectlContext[]> {
|
|||||||
|
|
||||||
export async function setContext(kubectl: Kubectl, targetContext: string): Promise<void> {
|
export async function setContext(kubectl: Kubectl, targetContext: string): Promise<void> {
|
||||||
const shellResult = await kubectl.invokeAsync(`config use-context ${targetContext}`);
|
const shellResult = await kubectl.invokeAsync(`config use-context ${targetContext}`);
|
||||||
if (!shellResult || shellResult.code != 0) {
|
if (!shellResult || shellResult.code !== 0) {
|
||||||
// TODO: Update error handling for now.
|
// TODO: Update error handling for now.
|
||||||
vscode.window.showErrorMessage(`Failed to set '${targetContext}' as current cluster: ${shellResult ? shellResult.stderr : "Unable to run kubectl"}`);
|
let errMsg = shellResult ? shellResult.stderr : localize('runKubectlFailed', 'Unable to run kubectl');
|
||||||
|
vscode.window.showErrorMessage(localize('setClusterFailed', 'Failed to set \'{0}\' as current cluster: {1}', targetContext, errMsg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function inferCurrentClusterType(kubectl: Kubectl): Promise<ClusterType> {
|
export async function inferCurrentClusterType(kubectl: Kubectl): Promise<ClusterType> {
|
||||||
let latestContextName = "";
|
let latestContextName = '';
|
||||||
|
|
||||||
const ctxsr = await kubectl.invokeAsync('config current-context');
|
const ctxsr = await kubectl.invokeAsync('config current-context');
|
||||||
if (ctxsr && ctxsr.code === 0) {
|
if (ctxsr && ctxsr.code === 0) {
|
||||||
|
|||||||
@@ -5,12 +5,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import vscode = require('vscode');
|
import vscode = require('vscode');
|
||||||
|
import * as nls from 'vscode-nls';
|
||||||
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import { MainController } from './mainController';
|
import { MainController } from './mainController';
|
||||||
|
|
||||||
import { fs } from './utility/fs';
|
import { fs } from './utility/fs';
|
||||||
|
|
||||||
import { host } from './kubectl/host';
|
import { host } from './kubectl/host';
|
||||||
import { sqlserverbigdataclusterchannel } from './kubectl/SqlServerBigDataClusterChannel';
|
import { sqlserverbigdataclusterchannel } from './kubectl/sqlServerBigDataClusterChannel';
|
||||||
import { shell, Shell } from './utility/shell';
|
import { shell, Shell } from './utility/shell';
|
||||||
import { CheckPresentMessageMode, create as kubectlCreate } from './kubectl/kubectl';
|
import { CheckPresentMessageMode, create as kubectlCreate } from './kubectl/kubectl';
|
||||||
import { installKubectl } from './installer/installer';
|
import { installKubectl } from './installer/installer';
|
||||||
@@ -36,22 +39,22 @@ export async function installDependencies() {
|
|||||||
|
|
||||||
|
|
||||||
const installPromises = [
|
const installPromises = [
|
||||||
installDependency("kubectl", gotKubectl, installKubectl),
|
installDependency('kubectl', gotKubectl, installKubectl)
|
||||||
];
|
];
|
||||||
|
|
||||||
await Promise.all(installPromises);
|
await Promise.all(installPromises);
|
||||||
|
|
||||||
sqlserverbigdataclusterchannel.showOutput("Done");
|
sqlserverbigdataclusterchannel.showOutput(localize('done', 'Done'));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function installDependency(name: string, alreadyGot: boolean, installFunc: (shell: Shell) => Promise<Errorable<null>>): Promise<void> {
|
async function installDependency(name: string, alreadyGot: boolean, installFunc: (shell: Shell) => Promise<Errorable<null>>): Promise<void> {
|
||||||
if (alreadyGot) {
|
if (alreadyGot) {
|
||||||
sqlserverbigdataclusterchannel.showOutput(`Already got ${name}...`);
|
sqlserverbigdataclusterchannel.showOutput(localize('dependencyInstalled', '{0} already installed...', name));
|
||||||
} else {
|
} else {
|
||||||
sqlserverbigdataclusterchannel.showOutput(`Installing ${name}...`);
|
sqlserverbigdataclusterchannel.showOutput(localize('installingDependency', 'Installing {0}...', name));
|
||||||
const result = await installFunc(shell);
|
const result = await installFunc(shell);
|
||||||
if (failed(result)) {
|
if (failed(result)) {
|
||||||
sqlserverbigdataclusterchannel.showOutput(`Unable to install ${name}: ${result.error[0]}`);
|
sqlserverbigdataclusterchannel.showOutput(localize('installingDependencyFailed', 'Unable to install {0}: {1}', name, result.error[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import { fs } from '../utility/fs';
|
|||||||
import { Shell } from '../utility/shell';
|
import { Shell } from '../utility/shell';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as os from 'os';
|
||||||
import mkdirp = require('mkdirp');
|
import mkdirp = require('mkdirp');
|
||||||
import { Kubectl, baseKubectlPath } from '../kubectl/kubectl';
|
import { Kubectl, baseKubectlPath } from '../kubectl/kubectl';
|
||||||
import { KubectlContext } from '../kubectl/kubectlUtils';
|
import { KubectlContext } from '../kubectl/kubectlUtils';
|
||||||
@@ -42,13 +43,13 @@ export class ScriptGenerator {
|
|||||||
let deployFileName = `${deployFilePrefix}-${targetClusterName}-${timestamp}${deployFileSuffix}`;
|
let deployFileName = `${deployFilePrefix}-${targetClusterName}-${timestamp}${deployFileSuffix}`;
|
||||||
let deployFilePath = path.join(deployFolder, deployFileName);
|
let deployFilePath = path.join(deployFolder, deployFileName);
|
||||||
|
|
||||||
let envVars = "";
|
let envVars = '';
|
||||||
let propertiesDict = await scriptable.getScriptProperties();
|
let propertiesDict = await scriptable.getScriptProperties();
|
||||||
for (let key in propertiesDict) {
|
for (let key in propertiesDict) {
|
||||||
let value = propertiesDict[key];
|
let value = propertiesDict[key];
|
||||||
envVars += this._shell.isWindows() ? `Set ${key} = ${value}\n` : `export ${key} = ${value}\n`;
|
envVars += this._shell.isWindows() ? `Set ${key} = ${value}\n` : `export ${key} = ${value}\n`;
|
||||||
}
|
}
|
||||||
envVars += '\n';
|
envVars += os.EOL;
|
||||||
|
|
||||||
let kubeContextcommand = `${this._kubectlPath} config use-context ${targetContextName}\n`;
|
let kubeContextcommand = `${this._kubectlPath} config use-context ${targetContextName}\n`;
|
||||||
// Todo: The API for mssqlctl may change per version, so need a version check to use proper syntax.
|
// Todo: The API for mssqlctl may change per version, so need a version check to use proper syntax.
|
||||||
|
|||||||
@@ -172,12 +172,12 @@ export function shellEnvironment(baseEnvironment: any): any {
|
|||||||
function pathVariableName(env: any): string {
|
function pathVariableName(env: any): string {
|
||||||
if (isWindows()) {
|
if (isWindows()) {
|
||||||
for (const v of Object.keys(env)) {
|
for (const v of Object.keys(env)) {
|
||||||
if (v.toLowerCase() === "path") {
|
if (v.toLowerCase() === 'path') {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "PATH";
|
return 'PATH';
|
||||||
}
|
}
|
||||||
|
|
||||||
function pathEntrySeparator() {
|
function pathEntrySeparator() {
|
||||||
|
|||||||
Reference in New Issue
Block a user