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:
@@ -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 };
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user