Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable odo telemetry when running through extension #2131

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions config/preference.yaml

This file was deleted.

10 changes: 8 additions & 2 deletions src/odo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,16 +761,22 @@ export class OdoImpl implements Odo {
return services;
}

public createEnv(): {} {
const env = {...process.env };
env.ODO_DISABLE_TELEMETRY = 'true';
return env;
}

public async executeInTerminal(command: CommandText, cwd: string = process.cwd(), name = 'OpenShift'): Promise<void> {
const [cmd] = `${command}`.split(' ');
const toolLocation = await ToolsConfig.detect(cmd);
const terminal: Terminal = WindowUtil.createTerminal(name, cwd);
const terminal: Terminal = WindowUtil.createTerminal(name, cwd, this.createEnv());
terminal.sendText(toolLocation === cmd ? `${command}` : `${command}`.replace(cmd, `"${toolLocation}"`), true);
terminal.show();
}

public async execute(command: CommandText, cwd?: string, fail = true, addEnv = {}): Promise<cliInstance.CliExitData> {
const env = {...process.env };
const env = this.createEnv();
const commandActual = `${command}`;
const commandPrivacy = `${command.privacyMode(true)}`;
const [cmd] = commandActual.split(' ');
Expand Down
2 changes: 1 addition & 1 deletion test/unit/odo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ suite('odo', () => {
const cwd = 'path/to/some/dir';
await odoCli.execute(command, cwd);

expect(execStub).calledOnceWith(`${command}`, { cwd, env: process.env });
expect(execStub).calledOnceWith(`${command}`, { cwd, env: (odo.getInstance() as odo.OdoImpl).createEnv() });
});

test('execute rejects if an error occurs in the shell command', async () => {
Expand Down