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:
Kevin Cunnane
2019-03-07 14:26:31 -08:00
committed by GitHub
parent 029c69ecd3
commit a4d99b78d5
10 changed files with 62 additions and 41 deletions

View File

@@ -26,7 +26,7 @@ function ensureDownloadFunc() {
}
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);
if (succeeded(downloadResult)) {
return { succeeded: true, result: tempFileObj.name };

View File

@@ -8,6 +8,9 @@ import * as download from './download';
import * as fs from 'fs';
import mkdirp = require('mkdirp');
import * as path from 'path';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { Shell, Platform } from '../utility/shell';
import { Errorable, failed } from '../interfaces';
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 downloadResult = await download.to(kubectlUrl, downloadFile);
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()) {
@@ -43,7 +46,7 @@ export async function installKubectl(shell: Shell): Promise<Errorable<null>> {
async function getStableKubectlVersion(): Promise<Errorable<string>> {
const downloadResult = await download.toTempFile('https://storage.googleapis.com/kubernetes-release/release/stable.txt');
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');
fs.unlinkSync(downloadResult.result);