This commit is contained in:
Sheng Chen 2018-02-06 13:47:44 +08:00 коммит произвёл GitHub
Родитель 913c767795
Коммит 12f417fddf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 11 добавлений и 54 удалений

Просмотреть файл

@ -1,6 +1,5 @@
"use strict";
import * as vscode from "vscode";
import { TFTerminal } from "./shared";
import { terraformChannel } from "./terraformChannel";
@ -12,35 +11,10 @@ export abstract class BaseShell {
this.initShellInternal();
}
public runTerraformCmd(tfCommand: string, workingDir: string): void {
// We keep the TFConfiguration for the moment - will need to be updated to sync folders
const tfActiveFile = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.fileName : null;
terraformChannel.appendLine(`Running - ${tfCommand}, Active File: ${tfActiveFile}`);
// Run Terraform command
this.runTerraformInternal(tfCommand, workingDir);
}
public async runTerraformCmdAsync(tfCommand: string): Promise<any> {
const tfActiveFile = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.fileName : null;
terraformChannel.appendLine(`Running - ${tfCommand}`);
terraformChannel.show();
return this.runTerraformAsyncInternal(tfActiveFile, tfCommand);
}
public abstract runTerraformCmd(tfCommand: string, workingDir: string);
public abstract runTerraformTests(testType: string, workingDirectory: string);
protected output(label: string, message: string): void {
terraformChannel.appendLine(`[${label}] ${message}`);
}
protected outputLine(label: string, message: string): void {
terraformChannel.appendLine(`[${label}] ${message}`);
}
protected isWindows(): boolean {
return process.platform === "win32";
}
@ -54,7 +28,5 @@ export abstract class BaseShell {
}
}
protected abstract runTerraformInternal(tfCommand: string, workingDir: string);
protected abstract runTerraformAsyncInternal(tfConfiguration: string, tfCommand: string): void;
protected abstract initShellInternal();
}

Просмотреть файл

@ -113,7 +113,7 @@ export class CloudShell extends BaseShell {
}
protected async runTerraformInternal(TFCommand: string, WorkDir: string): Promise<void> {
public async runTerraformCmd(tfCommand: string, workingDir: string): Promise<void> {
// Workaround the TLS error
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
// TODO: Check if logged with azure account
@ -125,9 +125,9 @@ export class CloudShell extends BaseShell {
this.tfTerminal.storageAccountKey = terminal[3];
this.tfTerminal.fileShareName = terminal[4];
this.tfTerminal.ResourceGroup = terminal[5];
await this.runTFCommand(TFCommand, WorkDir, this.tfTerminal.terminal);
await this.runTFCommand(tfCommand, workingDir, this.tfTerminal.terminal);
} else {
await this.runTFCommand(TFCommand, WorkDir, this.tfTerminal.terminal);
await this.runTFCommand(tfCommand, workingDir, this.tfTerminal.terminal);
}
}
@ -142,10 +142,6 @@ export class CloudShell extends BaseShell {
});
}
protected runTerraformAsyncInternal(TFConfiguration: string, TFCommand: string): void {
return null;
}
protected async startCloudShell(): Promise<Terminal> {
const accountAPI: AzureAccount = vscode.extensions
.getExtension<AzureAccount>("ms-vscode.azure-account")!.exports;

Просмотреть файл

@ -111,6 +111,13 @@ export class IntegratedShell extends BaseShell {
}
}
public runTerraformCmd(tfCommand: string, workingDir: string): void {
this.checkCreateTerminal();
const term = this.tfTerminal.terminal;
term.show();
term.sendText(tfCommand);
}
protected initShellInternal() {
this.tfTerminal = new TFTerminal(TerminalType.Integrated, Constants.TerraformTerminalName);
vscode.window.onDidCloseTerminal((terminal) => {
@ -121,24 +128,6 @@ export class IntegratedShell extends BaseShell {
});
}
protected runTerraformInternal(TFCommand: string, WorkDir: string): void {
this.checkCreateTerminal();
const term = this.tfTerminal.terminal;
term.show();
term.sendText(TFCommand);
return;
}
protected runTerraformAsyncInternal(TFConfiguration: string, TFCommand: string): void {
this.checkCreateTerminal();
const term = this.tfTerminal.terminal;
term.show();
term.sendText(TFCommand);
}
private async deletePng(cwd: string): Promise<void> {
const graphPath: string = path.join(cwd, IntegratedShell.GRAPH_FILE_NAME);
if (await fse.pathExists(graphPath)) {