Changes to remove Pip3 based installations for azdata (#8577)

* saving intermediate work - to merge master

* remove inadvertent change

* Remove Pip3 installation from all tools

* working version

* making some small fixes

* add back accidently removed file

* Update resourceTypePickerDialog.ts

* Removing redundant trailing ","

* Remove commented dead code

* fix casing of nls string

* remove inadvertent change

* change installation locations from field to properties so that they are constructed at run time'
This commit is contained in:
Arvind Ranasaria
2019-12-05 17:15:27 -08:00
committed by GitHub
parent 4787d7ba5c
commit 7201025a15
11 changed files with 129 additions and 160 deletions

View File

@@ -29,15 +29,9 @@
{ {
"title": "%deployment.configuration.title%", "title": "%deployment.configuration.title%",
"properties": { "properties": {
"deployment.azdataPipInstallUri": { "deployment.azdataInstallLocation": {
"type": "string", "type": "string",
"default": "https://aka.ms/azdata", "description": "%azdata-install-location-description%"
"description": "%azdata-pip-install-uri-description%"
},
"deployment.azdataPipInstallArgs": {
"type": "string",
"default": "",
"description": "%azdata-pip-install-args-description%"
} }
} }
} }

View File

@@ -49,6 +49,5 @@
"bdc-agreement-azdata-eula": "azdata License Terms", "bdc-agreement-azdata-eula": "azdata License Terms",
"bdc-agreement-bdc-eula": "SQL Server License Terms", "bdc-agreement-bdc-eula": "SQL Server License Terms",
"deployment.configuration.title": "Deployment configuration", "deployment.configuration.title": "Deployment configuration",
"azdata-pip-install-uri-description": "Location of the azdata package used for the pip install command", "azdata-install-location-description": "Location of the azdata package used for the install command"
"azdata-pip-install-args-description": "Additional arguments for the pip install azdata command"
} }

View File

@@ -4,5 +4,4 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
export const DeploymentConfigurationKey: string = 'deployment'; export const DeploymentConfigurationKey: string = 'deployment';
export const AzdataPipInstallUriKey: string = 'azdataPipInstallUri'; export const AzdataInstallLocationKey: string = 'azdataInstallLocation';
export const azdataPipInstallArgsKey: string = 'azdataPipInstallArgs';

View File

@@ -248,11 +248,10 @@ export interface ITool {
readonly dependencyMessages: string[]; readonly dependencyMessages: string[];
readonly statusDescription: string | undefined; readonly statusDescription: string | undefined;
readonly autoInstallSupported: boolean; readonly autoInstallSupported: boolean;
readonly autoInstallRequired: boolean; readonly autoInstallNeeded: boolean;
readonly isNotInstalled: boolean; readonly isNotInstalled: boolean;
readonly isInstalled: boolean; readonly isInstalled: boolean;
readonly installationPath: string; readonly installationPath: string;
readonly needsInstallation: boolean;
readonly outputChannelName: string; readonly outputChannelName: string;
readonly fullVersion: string | undefined; readonly fullVersion: string | undefined;
readonly onDidUpdateData: vscode.Event<ITool>; readonly onDidUpdateData: vscode.Event<ITool>;

View File

@@ -39,10 +39,6 @@ export class AzCliTool extends ToolBase {
return 'https://docs.microsoft.com/cli/azure/install-azure-cli'; return 'https://docs.microsoft.com/cli/azure/install-azure-cli';
} }
get autoInstallSupported(): boolean {
return true;
}
protected async getSearchPaths(): Promise<string[]> { protected async getSearchPaths(): Promise<string[]> {
switch (this.osDistribution) { switch (this.osDistribution) {
case OsDistribution.win32: case OsDistribution.win32:

View File

@@ -7,7 +7,7 @@ import * as path from 'path';
import { SemVer } from 'semver'; import { SemVer } from 'semver';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
import { azdataPipInstallArgsKey, AzdataPipInstallUriKey, DeploymentConfigurationKey } from '../../constants'; import { AzdataInstallLocationKey, DeploymentConfigurationKey } from '../../constants';
import { Command, OsDistribution, ToolType } from '../../interfaces'; import { Command, OsDistribution, ToolType } from '../../interfaces';
import { IPlatformService } from '../platformService'; import { IPlatformService } from '../platformService';
import { dependencyType, ToolBase } from './toolBase'; import { dependencyType, ToolBase } from './toolBase';
@@ -62,11 +62,6 @@ export class AzdataTool extends ToolBase {
} }
return version; return version;
} }
get autoInstallSupported(): boolean {
return true;
}
protected async getSearchPaths(): Promise<string[]> { protected async getSearchPaths(): Promise<string[]> {
switch (this.osDistribution) { switch (this.osDistribution) {
case OsDistribution.win32: case OsDistribution.win32:
@@ -87,51 +82,34 @@ export class AzdataTool extends ToolBase {
protected get allInstallationCommands(): Map<OsDistribution, Command[]> { protected get allInstallationCommands(): Map<OsDistribution, Command[]> {
return new Map<OsDistribution, Command[]>([ return new Map<OsDistribution, Command[]>([
[OsDistribution.debian, debianInstallationCommands], [OsDistribution.debian, this.debianInstallationCommands],
[OsDistribution.win32, win32InstallationCommands], [OsDistribution.win32, this.win32InstallationCommands],
[OsDistribution.darwin, macOsInstallationCommands], [OsDistribution.darwin, this.macOsInstallationCommands],
[OsDistribution.others, this.defaultInstallationCommands] [OsDistribution.others, []]
]); ]);
} }
protected get uninstallCommand(): string | undefined {
return this.defaultUninstallCommand; private get azdataInstallLocation(): string {
return vscode.workspace.getConfiguration(DeploymentConfigurationKey)[AzdataInstallLocationKey] || this.defaultInstallLocationByDistribution.get(this.osDistribution);
} }
private get defaultInstallationCommands(): Command[] { private defaultInstallLocationByDistribution: Map<OsDistribution, string> = new Map<OsDistribution, string>([
return [ [OsDistribution.debian, 'https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list'],
{ [OsDistribution.win32, 'https://aka.ms/azdata-msi'],
comment: localize('resourceDeployment.Azdata.InstallUpdatePythonRequestsPackage', "installing/updating to latest version of requests python package azdata …"), [OsDistribution.darwin, 'microsoft/azdata-cli-release'],
command: `pip3 install -U requests` [OsDistribution.others, '']
}, ]);
{
comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata …"),
command: `pip3 install -r ${this.azdataInstallUri} ${this.azdataInstallAdditionalArgs} --quiet --user`
}
];
}
private get defaultUninstallCommand(): string {
return `pip3 uninstall -r ${this.azdataInstallUri} ${this.azdataInstallAdditionalArgs} -y `;
}
private get azdataInstallUri(): string {
return vscode.workspace.getConfiguration(DeploymentConfigurationKey)[AzdataPipInstallUriKey];
}
private get azdataInstallAdditionalArgs(): string {
return vscode.workspace.getConfiguration(DeploymentConfigurationKey)[azdataPipInstallArgsKey];
}
protected dependenciesByOsType: Map<OsDistribution, dependencyType[]> = new Map<OsDistribution, dependencyType[]>([ protected dependenciesByOsType: Map<OsDistribution, dependencyType[]> = new Map<OsDistribution, dependencyType[]>([
[OsDistribution.debian, []], [OsDistribution.debian, []],
[OsDistribution.win32, []], [OsDistribution.win32, []],
[OsDistribution.darwin, []], [OsDistribution.darwin, [dependencyType.Brew]],
[OsDistribution.others, [dependencyType.PythonAndPip3]] [OsDistribution.others, []]
]); ]);
}
const win32InstallationCommands = [ private get win32InstallationCommands() {
return [
{ {
comment: localize('resourceDeployment.Azdata.DeletingPreviousAzdata.msi', "deleting previously downloaded Azdata.msi if one exists …"), comment: localize('resourceDeployment.Azdata.DeletingPreviousAzdata.msi', "deleting previously downloaded Azdata.msi if one exists …"),
command: `IF EXIST .\\Azdata.msi DEL /F .\\Azdata.msi` command: `IF EXIST .\\Azdata.msi DEL /F .\\Azdata.msi`
@@ -139,18 +117,21 @@ const win32InstallationCommands = [
{ {
sudo: true, sudo: true,
comment: localize('resourceDeployment.Azdata.DownloadingAndInstallingAzdata', "downloading Azdata.msi and installing azdata-cli …"), comment: localize('resourceDeployment.Azdata.DownloadingAndInstallingAzdata', "downloading Azdata.msi and installing azdata-cli …"),
command: `powershell -Command "& {(New-Object System.Net.WebClient).DownloadFile('https://aka.ms/azdata-msi', 'Azdata.msi'); Start-Process msiexec.exe -Wait -ArgumentList '/I Azdata.msi /passive /quiet /lvx ADS_AzdataInstall.log'}"` command: `powershell -Command "& {(New-Object System.Net.WebClient).DownloadFile('${this.azdataInstallLocation}', 'Azdata.msi'); Start-Process msiexec.exe -Wait -ArgumentList '/I Azdata.msi /passive /quiet /lvx ADS_AzdataInstall.log'}"`
}, },
{ {
comment: localize('resourceDeployment.Azdata.DisplayingInstallationLog', "displaying the installation log …"), comment: localize('resourceDeployment.Azdata.DisplayingInstallationLog', "displaying the installation log …"),
command: `type ADS_AzdataInstall.log | findstr /i /v ^MSI"`, command: `type ADS_AzdataInstall.log | findstr /i /v ^MSI"`,
ignoreError: true ignoreError: true
} }
]; ];
const macOsInstallationCommands = [ }
private get macOsInstallationCommands() {
return [
{ {
comment: localize('resourceDeployment.Azdata.TappingBrewRepository', "tapping into the brew repository for azdata-cli …"), comment: localize('resourceDeployment.Azdata.TappingBrewRepository', "tapping into the brew repository for azdata-cli …"),
command: 'brew tap microsoft/azdata-cli-release' command: `brew tap ${this.azdataInstallLocation}`
}, },
{ {
comment: localize('resourceDeployment.Azdata.UpdatingBrewRepository', "updating the brew repository for azdata-cli installation …"), comment: localize('resourceDeployment.Azdata.UpdatingBrewRepository', "updating the brew repository for azdata-cli installation …"),
@@ -160,8 +141,11 @@ const macOsInstallationCommands = [
comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata …"), comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata …"),
command: 'brew install azdata-cli' command: 'brew install azdata-cli'
} }
]; ];
const debianInstallationCommands = [ }
private get debianInstallationCommands() {
return [
{ {
sudo: true, sudo: true,
comment: localize('resourceDeployment.Azdata.AptGetUpdate', "updating repository information …"), comment: localize('resourceDeployment.Azdata.AptGetUpdate', "updating repository information …"),
@@ -180,7 +164,7 @@ const debianInstallationCommands = [
{ {
sudo: true, sudo: true,
comment: localize('resourceDeployment.Azdata.AddingAzdataRepositoryInformation', "adding the azdata repository information …"), comment: localize('resourceDeployment.Azdata.AddingAzdataRepositoryInformation', "adding the azdata repository information …"),
command: 'add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)"' command: `add-apt-repository "$(wget -qO- ${this.azdataInstallLocation})"`
}, },
{ {
sudo: true, sudo: true,
@@ -192,4 +176,6 @@ const debianInstallationCommands = [
comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata …"), comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata …"),
command: 'apt-get install -y azdata-cli' command: 'apt-get install -y azdata-cli'
} }
]; ];
}
}

View File

@@ -47,11 +47,5 @@ export class DockerTool extends ToolBase {
return { command: 'docker version --format "{{json .}}"' }; return { command: 'docker version --format "{{json .}}"' };
} }
get autoInstallSupported(): boolean { protected readonly allInstallationCommands: Map<OsDistribution, Command[]> = new Map<OsDistribution, Command[]>();
return false;
}
protected get allInstallationCommands(): Map<OsDistribution, Command[]> {
throw Error('Installation of DockerTool is not supported');
}
} }

View File

@@ -57,11 +57,6 @@ export class KubeCtlTool extends ToolBase {
command: this.discoveryCommandString('kubectl') command: this.discoveryCommandString('kubectl')
}; };
} }
get autoInstallSupported(): boolean {
return true;
}
protected async getSearchPaths(): Promise<string[]> { protected async getSearchPaths(): Promise<string[]> {
switch (this.osDistribution) { switch (this.osDistribution) {
case OsDistribution.win32: case OsDistribution.win32:

View File

@@ -27,17 +27,14 @@ const toolStatusLocalized: Map<ToolStatus, string> = new Map<ToolStatus, string>
]); ]);
export const enum dependencyType { export const enum dependencyType {
PythonAndPip3 = 'PythonAndPip3',
Brew = 'Brew', Brew = 'Brew',
Curl = 'Curl' Curl = 'Curl'
} }
const pythonAndPip3Localized = localize('deploymentDialog.ToolInformationalMessage.PythonAndPip3', "• azdata installation needs pip3 and python3 version 3.6 to be pre-installed before necessary tools can be deployed");
const brewLocalized = localize('deploymentDialog.ToolInformationalMessage.Brew', "• brew is needed for deployment of the tools and needs to be pre-installed before necessary tools can be deployed"); const brewLocalized = localize('deploymentDialog.ToolInformationalMessage.Brew', "• brew is needed for deployment of the tools and needs to be pre-installed before necessary tools can be deployed");
const curlLocalized = localize('deploymentDialog.ToolInformationalMessage.Curl', "• curl is needed for installation and needs to be pre-installed before necessary tools can be deployed"); const curlLocalized = localize('deploymentDialog.ToolInformationalMessage.Curl', "• curl is needed for installation and needs to be pre-installed before necessary tools can be deployed");
export const messageByDependencyType: Map<dependencyType, string> = new Map<dependencyType, string>([ export const messageByDependencyType: Map<dependencyType, string> = new Map<dependencyType, string>([
[dependencyType.PythonAndPip3, pythonAndPip3Localized],
[dependencyType.Brew, brewLocalized], [dependencyType.Brew, brewLocalized],
[dependencyType.Curl, curlLocalized] [dependencyType.Curl, curlLocalized]
]); ]);
@@ -51,7 +48,6 @@ export abstract class ToolBase implements ITool {
abstract description: string; abstract description: string;
abstract type: ToolType; abstract type: ToolType;
abstract homePage: string; abstract homePage: string;
abstract autoInstallSupported: boolean;
protected abstract readonly allInstallationCommands: Map<OsDistribution, Command[]>; protected abstract readonly allInstallationCommands: Map<OsDistribution, Command[]>;
protected readonly dependenciesByOsType: Map<OsDistribution, dependencyType[]> = new Map<OsDistribution, dependencyType[]>(); protected readonly dependenciesByOsType: Map<OsDistribution, dependencyType[]> = new Map<OsDistribution, dependencyType[]>();
@@ -100,7 +96,7 @@ export abstract class ToolBase implements ITool {
return <string>toolStatusLocalized.get(this._status); return <string>toolStatusLocalized.get(this._status);
} }
public get autoInstallRequired(): boolean { public get autoInstallNeeded(): boolean {
return this.status !== ToolStatus.Installed && this.autoInstallSupported; return this.status !== ToolStatus.Installed && this.autoInstallSupported;
} }
@@ -116,10 +112,6 @@ export abstract class ToolBase implements ITool {
return this.status === ToolStatus.Installing; return this.status === ToolStatus.Installing;
} }
public get needsInstallation(): boolean {
return this.status !== ToolStatus.Installed;
}
public get storagePath(): string { public get storagePath(): string {
return this._platformService.storagePath(); return this._platformService.storagePath();
} }
@@ -177,6 +169,11 @@ export abstract class ToolBase implements ITool {
this._platformService.showOutputChannel(preserveFocus); this._platformService.showOutputChannel(preserveFocus);
} }
get autoInstallSupported(): boolean {
return !!this.installationCommands && !!this.installationCommands.length;
}
public async install(): Promise<void> { public async install(): Promise<void> {
this._statusDescription = ''; this._statusDescription = '';
try { try {
@@ -207,7 +204,7 @@ export abstract class ToolBase implements ITool {
protected async installCore() { protected async installCore() {
const installationCommands: Command[] | undefined = this.installationCommands; const installationCommands: Command[] | undefined = this.installationCommands;
if (!installationCommands || installationCommands.length === 0) { if (!installationCommands || installationCommands.length === 0) {
throw new Error(localize('toolBase.installCore.CannotInstallTool', "Cannot install tool:${0}::${1} as installation commands are unknown", this.displayName, this.description)); throw new Error(localize('toolBase.installCore.CannotInstallTool', "Cannot install tool:{0}::{1} as installation commands are unknown for your OS distribution, Please install {0} manually before proceeding", this.displayName, this.description));
} }
for (let i: number = 0; i < installationCommands.length; i++) { for (let i: number = 0; i < installationCommands.length; i++) {
await this._platformService.runCommand(installationCommands[i].command, await this._platformService.runCommand(installationCommands[i].command,
@@ -229,11 +226,9 @@ export abstract class ToolBase implements ITool {
if (process.env.PATH) { if (process.env.PATH) {
if (!`${path.delimiter}${process.env.PATH}${path.delimiter}`.includes(`${path.delimiter}${searchPath}${path.delimiter}`)) { if (!`${path.delimiter}${process.env.PATH}${path.delimiter}`.includes(`${path.delimiter}${searchPath}${path.delimiter}`)) {
process.env.PATH += `${path.delimiter}${searchPath}`; process.env.PATH += `${path.delimiter}${searchPath}`;
console.log(`Appending to Path -> '${path.delimiter}${searchPath}'`);
} }
} else { } else {
process.env.PATH = searchPath; process.env.PATH = searchPath;
console.log(`Setting PATH to -> '${searchPath}'`);
} }
}); });
} }

View File

@@ -27,6 +27,7 @@ export class ResourceTypePickerDialog extends DialogBase {
private _agreementContainer!: azdata.DivContainer; private _agreementContainer!: azdata.DivContainer;
private _agreementCheckboxChecked: boolean = false; private _agreementCheckboxChecked: boolean = false;
private _installToolButton: azdata.window.Button; private _installToolButton: azdata.window.Button;
private _installationInProgress: boolean = false;
private _tools: ITool[] = []; private _tools: ITool[] = [];
constructor( constructor(
@@ -42,6 +43,7 @@ export class ResourceTypePickerDialog extends DialogBase {
this._dialogObject.customButtons = [this._installToolButton]; this._dialogObject.customButtons = [this._installToolButton];
this._installToolButton.hidden = true; this._installToolButton.hidden = true;
this._dialogObject.okButton.label = localize('deploymentDialog.OKButtonText', "Select"); this._dialogObject.okButton.label = localize('deploymentDialog.OKButtonText', "Select");
this._dialogObject.okButton.enabled = false; // this is enabled after all tools are discovered.
} }
initialize() { initialize() {
@@ -216,33 +218,33 @@ export class ResourceTypePickerDialog extends DialogBase {
if (this.toolRefreshTimestamp !== currentRefreshTimestamp) { if (this.toolRefreshTimestamp !== currentRefreshTimestamp) {
return; return;
} }
let installationRequired = false; let installationNeeded = false;
let minVersionCheckFailed = false; let minVersionCheckFailed = false;
const messages: string[] = []; const messages: string[] = [];
this._toolsTable.data = toolRequirements.map(toolReq => { this._toolsTable.data = toolRequirements.map(toolRequirement => {
const tool = this.toolsService.getToolByName(toolReq.name)!; const tool = this.toolsService.getToolByName(toolRequirement.name)!;
// subscribe to onUpdateData event of the tool. // subscribe to onUpdateData event of the tool.
this._toDispose.push(tool.onDidUpdateData((t: ITool) => { this._toDispose.push(tool.onDidUpdateData((t: ITool) => {
this.updateToolsDisplayTableData(t); this.updateToolsDisplayTableData(t);
})); }));
if (tool.isNotInstalled && !tool.autoInstallSupported) { if (tool.isNotInstalled && !tool.autoInstallSupported) {
messages.push(localize('deploymentDialog.ToolInformation', "'{0}' [ {1} ]", tool.displayName, tool.homePage)); messages.push(localize('deploymentDialog.ToolInformation', "'{0}' was not discovered and automated installation is not supported. Kindly install it manually or if installed make sure it is started and discoverable. Once done please restart Azure Data Studio. See [{1}] .", tool.displayName, tool.homePage));
if (tool.statusDescription !== undefined) { if (tool.statusDescription !== undefined) {
console.warn(localize('deploymentDialog.DetailToolStatusDescription', "Additional status information for tool: '{0}' [ {1} ]. {2}", tool.name, tool.homePage, tool.statusDescription)); console.warn(localize('deploymentDialog.DetailToolStatusDescription', "Additional status information for tool: '{0}' [ {1} ]. {2}", tool.name, tool.homePage, tool.statusDescription));
} }
} else if (tool.isInstalled && toolReq.version && !tool.isSameOrNewerThan(toolReq.version)) { } else if (tool.isInstalled && toolRequirement.version && !tool.isSameOrNewerThan(toolRequirement.version)) {
minVersionCheckFailed = true; minVersionCheckFailed = true;
messages.push(localize('deploymentDialog.ToolDoesNotMeetVersionRequirement', "'{0}' [ {1} ] does not meet the minimum version requirement, please uninstall it and restart Azure Data Studio.", tool.displayName, tool.homePage)); messages.push(localize('deploymentDialog.ToolDoesNotMeetVersionRequirement', "'{0}' [ {1} ] does not meet the minimum version requirement, please uninstall it and restart Azure Data Studio.", tool.displayName, tool.homePage));
} }
installationRequired = installationRequired || tool.autoInstallRequired; installationNeeded = installationNeeded || tool.autoInstallNeeded;
return [tool.displayName, tool.description, tool.displayStatus, tool.fullVersion || '', toolReq.version || '']; return [tool.displayName, tool.description, tool.displayStatus, tool.fullVersion || '', toolRequirement.version || ''];
}); });
this._installToolButton.hidden = minVersionCheckFailed || !installationRequired; this._installToolButton.hidden = minVersionCheckFailed || !installationNeeded;
this._dialogObject.okButton.enabled = messages.length === 0 && !minVersionCheckFailed && !installationRequired; this._dialogObject.okButton.enabled = messages.length === 0 && !minVersionCheckFailed && !installationNeeded;
if (messages.length !== 0) { if (messages.length !== 0) {
if (!minVersionCheckFailed) { if (!minVersionCheckFailed) {
messages.push(localize('deploymentDialog.VersionInformationDebugHint', "You will need to restart Azure Data Studio if the tools are installed by yourself after Azure Data Studio is launched to pick up the updated PATH environment variable. You may find additional details in the debug console by running the 'Toggle Developer Tools' command in the Azure Data Studio Command Palette.")); messages.push(localize('deploymentDialog.VersionInformationDebugHint', "You will need to restart Azure Data Studio if the tools are installed by yourself after Azure Data Studio is launched to pick up the updated PATH environment variable. You may find additional details in 'Deployments' output channel"));
} }
this._dialogObject.message = { this._dialogObject.message = {
level: azdata.window.MessageLevel.Error, level: azdata.window.MessageLevel.Error,
@@ -251,10 +253,10 @@ export class ResourceTypePickerDialog extends DialogBase {
...messages ...messages
].join(EOL) ].join(EOL)
}; };
} else if (installationRequired) { } else if (installationNeeded && !this._installationInProgress) {
let infoText: string[] = [localize('deploymentDialog.InstallToolsHint', "Some required tools are not installed, you can click the \"{0}\" button to install them.", this._installToolButton.label)]; let infoText: string[] = [localize('deploymentDialog.InstallToolsHint', "Some required tools are not installed, you can click the \"{0}\" button to install them.", this._installToolButton.label)];
const informationalMessagesArray = this._tools.reduce<string[]>((returnArray, currentTool) => { const informationalMessagesArray = this._tools.reduce<string[]>((returnArray, currentTool) => {
if (currentTool.needsInstallation) { if (currentTool.autoInstallNeeded) {
returnArray.push(...currentTool.dependencyMessages); returnArray.push(...currentTool.dependencyMessages);
} }
return returnArray; return returnArray;
@@ -338,13 +340,15 @@ export class ResourceTypePickerDialog extends DialogBase {
private async installTools(): Promise<void> { private async installTools(): Promise<void> {
this._installToolButton.enabled = false; this._installToolButton.enabled = false;
this._installationInProgress = true;
let tool: ITool; let tool: ITool;
try { try {
const toolRequirements = this.getCurrentProvider().requiredTools; const toolRequirements = this.getCurrentProvider().requiredTools;
let toolsNotInstalled: ITool[] = [];
for (let i: number = 0; i < toolRequirements.length; i++) { for (let i: number = 0; i < toolRequirements.length; i++) {
const toolReq = toolRequirements[i]; const toolReq = toolRequirements[i];
tool = this.toolsService.getToolByName(toolReq.name)!; tool = this.toolsService.getToolByName(toolReq.name)!;
if (tool.needsInstallation) { if (tool.autoInstallNeeded) {
// Update the informational message // Update the informational message
this._dialogObject.message = { this._dialogObject.message = {
level: azdata.window.MessageLevel.Information, level: azdata.window.MessageLevel.Information,
@@ -358,14 +362,23 @@ export class ResourceTypePickerDialog extends DialogBase {
) )
); );
} }
} else {
toolsNotInstalled.push(tool);
} }
} }
// Update the informational message // Update the informational message
if (toolsNotInstalled.length === 0) {
this._dialogObject.message = { this._dialogObject.message = {
level: azdata.window.MessageLevel.Information, level: azdata.window.MessageLevel.Information,
text: localize('deploymentDialog.InstalledTools', "All required tools are installed now.") text: localize('deploymentDialog.InstalledTools', "All required tools are installed now.")
}; };
this._dialogObject.okButton.enabled = true; this._dialogObject.okButton.enabled = true;
} else {
this._dialogObject.message = {
level: azdata.window.MessageLevel.Information,
text: localize('deploymentDialog.PendingInstallation', "Following tools: {0} were still not discovered. Please make sure that they are installed, running and discoverable", toolsNotInstalled.map(t => t.displayName).join(','))
};
}
} catch (error) { } catch (error) {
const errorMessage = tool!.statusDescription || getErrorMessage(error); const errorMessage = tool!.statusDescription || getErrorMessage(error);
if (errorMessage) { if (errorMessage) {
@@ -377,5 +390,6 @@ export class ResourceTypePickerDialog extends DialogBase {
} }
tool!.showOutputChannel(/*preserverFocus*/false); tool!.showOutputChannel(/*preserverFocus*/false);
} }
this._installationInProgress = false;
} }
} }

View File

@@ -32,12 +32,10 @@ export function setEnvironmentVariablesForInstallPaths(tools: ITool[]): void {
const envVarName = getRuntimeBinaryPathEnvironmentVariableName(t.name); const envVarName = getRuntimeBinaryPathEnvironmentVariableName(t.name);
process.env[envVarName] = t.installationPath; process.env[envVarName] = t.installationPath;
installationPaths.add(path.dirname(t.installationPath)); installationPaths.add(path.dirname(t.installationPath));
console.log(`setting env var:'${envVarName}' to: '${t.installationPath}'`);
} }
}); });
if (installationPaths.size > 0) { if (installationPaths.size > 0) {
const envVarToolsInstallationPath: string = [...installationPaths.values()].join(path.delimiter); const envVarToolsInstallationPath: string = [...installationPaths.values()].join(path.delimiter);
process.env[ToolsInstallPath] = envVarToolsInstallationPath; process.env[ToolsInstallPath] = envVarToolsInstallationPath;
console.log(`setting env var:'${ToolsInstallPath}' to: '${envVarToolsInstallationPath}'`);
} }
} }