Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
chore: fix review comments
Browse files Browse the repository at this point in the history
*  Add semicolon and fix indetation using Prettier extesnion
*  Use vscode-uri package to get document path in commandRunner utility
*  Add progess status for downloaing EE
*  Change user message to log messeage at all applicable places
*  Add comments on code for better readability
*  Simplify logic to add `plugins` folder in `site-packages` path
*  Fix type on executionEnvironment service
*  Remove `--interactive` flag from container run command
  • Loading branch information
ganeshrn committed Sep 28, 2021
1 parent 9eead6f commit f07813d
Show file tree
Hide file tree
Showing 9 changed files with 468 additions and 327 deletions.
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
"mocha": "^8.4.0",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^9.1.1",
"typescript": "^4.3.5"
Expand Down
5 changes: 2 additions & 3 deletions src/interfaces/extensionSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

export type IContianerEngine = 'auto' | 'podman' | 'docker';
export type IContainerEngine = 'auto' | 'podman' | 'docker';

export type IPullPolicy = 'always' | 'missing' | 'never' | 'tag';

Expand All @@ -11,7 +10,7 @@ export interface ExtensionSettings {
}

interface ExecutionEnvironmentSettings {
containerEngine: IContianerEngine;
containerEngine: IContainerEngine;
enabled: boolean;
image: string;
pullPolicy: IPullPolicy;
Expand Down
16 changes: 11 additions & 5 deletions src/services/ansibleConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CommandRunner } from '../utils/commandRunner';
export class AnsibleConfig {
private connection: Connection;
private context: WorkspaceFolderContext;
private _collection_paths: string[] = [];
private _collection_paths: string[] = [];
private _module_locations: string[] = [];
private _ansible_location = '';

Expand All @@ -23,7 +23,11 @@ export class AnsibleConfig {
this.context.workspaceFolder.uri
);

const commandRunner = new CommandRunner(this.connection, this.context, settings)
const commandRunner = new CommandRunner(
this.connection,
this.context,
settings
);

// get Ansible configuration
const ansibleConfigResult = await commandRunner.runCommand(
Expand All @@ -41,7 +45,7 @@ export class AnsibleConfig {
// get Ansible basic information
const ansibleVersionResult = await commandRunner.runCommand(
'ansible',
'--version',
'--version'
);

const versionInfo = ini.parse(ansibleVersionResult.stdout);
Expand All @@ -58,9 +62,11 @@ export class AnsibleConfig {
// this is needed to get the pre-installed collections to work
const pythonPathResult = await commandRunner.runCommand(
'python3',
' -c "import sys; print(sys.path, end=\\"\\")"',
' -c "import sys; print(sys.path, end=\\"\\")"'
);
this._collection_paths.push(
...parsePythonStringArray(pythonPathResult.stdout)
);
this._collection_paths.push(...parsePythonStringArray(pythonPathResult.stdout));
} catch (error) {
if (error instanceof Error) {
this.connection.window.showErrorMessage(error.message);
Expand Down
4 changes: 2 additions & 2 deletions src/services/docsLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export class DocsLibrary {
);
const ansibleConfig = await this.context.ansibleConfig;
if (settings.executionEnvironment.enabled) {
await this.context.executionEnvironment
// ensure plugin/module cache is established
await this.context.executionEnvironment;
}
for (const modulesPath of ansibleConfig.module_locations) {
(await findDocumentation(modulesPath, 'builtin')).forEach((doc) => {
Expand Down Expand Up @@ -91,7 +92,6 @@ export class DocsLibrary {
);
}
}

}

/**
Expand Down
Loading

0 comments on commit f07813d

Please sign in to comment.