Replacing all azdata with az (#16502)

* Changed azdata to az in azcli extension and resource-deployment, and some arc. Removed user, pass, url from controller connect blade. Commented out tests. Ported over work from old branch.

* Changed unit tests, all unit tests passing. Changed parameters to new ones, fixed some Controller Connect issues.

* Connect data controller and create dc working.

* Changed az back to azdata in necessary places in resource-deployment.

* Changed notebook values and added namespace to some params.

* Added some changes from PR to this branch

* Changed azdata.ts to az.ts and changed subscription parameter

* Brought over changes from azcli PR into this branch.

* added endpoint, username, password to getIsPassword

* Changed notebooks to use proper az params, hard coded in some values to verify it is working, removed some variableNames from package.json.

* Changed -sc to --storage-class in notebook

* Added namespace to SQL deploy, deleted dc create in api

* Deleted more dc create code and uncommented findAz() with unfinished work on Do Not Ask Again.

* Removed (preview) from extensions/arc and extensions/azcli excluding preview:true in package.json

* Commented out install/update prompts until DoNotAskAgain is implemented

* Fixed bugs: JSON Output errors are now being caught, --infrastructure now has a required UI component with dropdown options, config page loads properly, SQL create flags use full names instead of shortnames.

* Adds validation to pg extensions and bug fixes (#16486)

* Extensions

* Server parameters

* Change locaiton of postgres extensions, pr fixes

* Change location of list

* List spacing

* Commented out Don't Ask Again prompt implementation.

* Uncommented header of a test file.

* Added Azure CLI arcdata extension to Prerequisites

* Reverted package.json and yarn.lock

* Took away casting of stderr and stdout in executeCommand.

* Deleted override function for initializeFields in connectControllerDialog.ts

* Removed fakeAzApi for testing and added back in (Preview)

* Removed en-us from python notebook links.

* Deleted azdata tool from tool tests in resource-deployment

* Deleted another instance of azdata in tool test

* Add back in azdata tooltype

* Remove en-us

* Replaced AzdataTool in typings

* Reverting adding azdata tool back in

* Changed Azdata to AzdataToolOld

* Added back azdata tool type

* Added AzdataToolOld to tool types

* fix test

Co-authored-by: Candice Ye <canye@microsoft.com>
Co-authored-by: nasc17 <nasc@microsoft.com>
Co-authored-by: nasc17 <69922333+nasc17@users.noreply.github.com>
Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Candice Ye
2021-08-01 15:12:24 -07:00
committed by GitHub
parent 65cc61fdbd
commit 914fe8fc29
58 changed files with 1623 additions and 2032 deletions

View File

@@ -4,20 +4,20 @@
*--------------------------------------------------------------------------------------------*/
import * as arc from 'arc';
import * as azdataExt from 'azdata-ext';
import * as azExt from 'az-ext';
import * as azurecore from 'azurecore';
import * as vscode from 'vscode';
export interface IApiService {
readonly azurecoreApi: azurecore.IExtension;
readonly azdataApi: azdataExt.IExtension;
readonly azApi: azExt.IExtension;
readonly arcApi: arc.IExtension;
}
class ApiService implements IApiService {
constructor() { }
public get azurecoreApi() { return vscode.extensions.getExtension(azurecore.extension.name)?.exports; }
public get azdataApi() { return vscode.extensions.getExtension(azdataExt.extension.name)?.exports; }
public get azApi() { return vscode.extensions.getExtension(azExt.extension.name)?.exports; }
public get arcApi() { return vscode.extensions.getExtension(arc.extension.name)?.exports; }
}

View File

@@ -1,137 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as azdataExt from 'azdata-ext';
import { EOL } from 'os';
import * as path from 'path';
import { SemVer } from 'semver';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Command, OsDistribution, ToolStatus, ToolType } from '../../interfaces';
import * as loc from '../../localizedConstants';
import { IPlatformService } from '../platformService';
import { ToolBase } from './toolBase';
const localize = nls.loadMessageBundle();
export const AzdataToolName = 'azdata';
const win32InstallationRoot = `${process.env['ProgramFiles(x86)']}\\Microsoft SDKs\\Azdata\\CLI\\wbin`;
const macInstallationRoot = '/usr/local/bin';
const debianInstallationRoot = '/usr/local/bin';
export class AzdataTool extends ToolBase {
private azdataApi!: azdataExt.IExtension;
constructor(platformService: IPlatformService) {
super(platformService);
}
get name(): string {
return AzdataToolName;
}
get description(): string {
return localize('resourceDeployment.AzdataDescription', "Azure Data command line interface");
}
get type(): ToolType {
return ToolType.Azdata;
}
get displayName(): string {
return localize('resourceDeployment.AzdataDisplayName', "Azure Data CLI");
}
get homePage(): string {
return 'https://docs.microsoft.com/sql/big-data-cluster/deploy-install-azdata';
}
public override async isEulaAccepted(): Promise<boolean> {
if (!this.azdataApi) {
return false;
}
if (await this.azdataApi.isEulaAccepted()) {
return true;
} else {
this.setStatusDescription(loc.azdataEulaNotAccepted);
return false;
}
}
public override async promptForEula(): Promise<boolean> {
const eulaAccepted = await this.azdataApi.promptForEula();
if (!eulaAccepted) {
this.setStatusDescription(loc.azdataEulaDeclined);
}
return eulaAccepted;
}
/* unused */
protected get versionCommand(): Command {
return {
command: ''
};
}
/* unused */
protected get discoveryCommand(): Command {
return {
command: ''
};
}
/**
* updates the version and status for the tool.
*/
protected override async updateVersionAndStatus(): Promise<void> {
this.azdataApi = await vscode.extensions.getExtension(azdataExt.extension.name)?.activate();
if (!this.azdataApi) {
this.setInstallationPathOrAdditionalInformation(localize('deploy.azdataExtMissing', "The Azure Data CLI extension must be installed to deploy this resource. Please install it through the extension gallery and try again."));
this.setStatus(ToolStatus.NotInstalled);
return;
}
this.setStatusDescription('');
await this.addInstallationSearchPathsToSystemPath();
const commandOutput = await this.azdataApi.azdata.version();
this.version = await this.azdataApi.azdata.getSemVersion();
if (this.version) {
if (this.autoInstallSupported) {
// set the installationPath
this.setInstallationPathOrAdditionalInformation(await this.azdataApi.azdata.getPath());
}
this.setStatus(ToolStatus.Installed);
}
else {
this.setInstallationPathOrAdditionalInformation(localize('deployCluster.GetToolVersionErrorInformation', "Error retrieving version information. See output channel '{0}' for more details", this.outputChannelName));
this.setStatusDescription(localize('deployCluster.GetToolVersionError', "Error retrieving version information.{0}Invalid output received, get version command output: '{1}' ", EOL, commandOutput.stderr.join(EOL)));
this.setStatus(ToolStatus.NotInstalled);
}
}
protected getVersionFromOutput(output: string): SemVer | Promise<SemVer> | undefined {
return this.azdataApi.azdata.getSemVersion();
}
protected override async getSearchPaths(): Promise<string[]> {
switch (this.osDistribution) {
case OsDistribution.win32:
return [win32InstallationRoot];
case OsDistribution.darwin:
return [macInstallationRoot];
case OsDistribution.debian:
return [debianInstallationRoot];
default:
const azdataCliInstallLocation = await this.getPip3InstallLocation('azdata-cli');
if (azdataCliInstallLocation) {
return [path.join(azdataCliInstallLocation, '..', 'Scripts'), path.join(azdataCliInstallLocation, '..', '..', '..', 'bin')];
} else {
return [];
}
}
}
protected get allInstallationCommands(): Map<OsDistribution, Command[]> {
return new Map<OsDistribution, Command[]>();
}
}

View File

@@ -5,7 +5,6 @@
import { ITool } from '../interfaces';
import { DockerTool } from './tools/dockerTool';
import { AzCliTool } from './tools/azCliTool';
import { AzdataTool } from './tools/azdataTool';
import { KubeCtlTool } from './tools/kubeCtlTool';
import { IPlatformService } from './platformService';
import { AzdataToolOld } from './tools/azdataToolOld';
@@ -24,7 +23,6 @@ export class ToolsService implements IToolsService {
[
new DockerTool(this._platformService),
new AzCliTool(this._platformService),
new AzdataTool(this._platformService),
new AzdataToolOld(this._platformService),
new KubeCtlTool(this._platformService)
].map<[string, ITool]>((tool: ITool) => [tool.name, tool])