Skip to content

Commit

Permalink
fix: log exit code when podman ssh command fails in VM
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Golovin <[email protected]>
  • Loading branch information
dgolovin committed Feb 14, 2024
1 parent 4f08650 commit ae3b5a0
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/podman-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,43 @@ export async function runSubscriptionManager(): Promise<number | undefined> {
await extensionApi.process.exec(getPodmanCli(), PODMAN_COMMANDS.SM_VERSION());
return 0;
} catch (err) {
return (err as extensionApi.RunError).exitCode;
const exitCode = (err as extensionApi.RunError).exitCode;
console.error(`Subscription manager execution returned exit code: ${exitCode}`);
return exitCode;
}
}

export async function runRpmInstallSubscriptionManager() {
export async function runRpmInstallSubscriptionManager(): Promise<number | undefined> {
try {
await extensionApi.process.exec(getPodmanCli(), PODMAN_COMMANDS.RPM_INSTALL_SM());
return 0;
} catch (err) {
return (err as extensionApi.RunError).exitCode;
const exitCode = (err as extensionApi.RunError).exitCode;
console.error(`Subscription manager installation returned exit code: ${exitCode}`);
return exitCode;
}
}

export async function runSubscriptionManagerActivationStatus() {
export async function runSubscriptionManagerActivationStatus(): Promise<number | undefined> {
try {
await extensionApi.process.exec(getPodmanCli(), PODMAN_COMMANDS.SM_ACTIVATION_STATUS());
return 0;
} catch (err) {
return (err as extensionApi.RunError).exitCode;
const exitCode = (err as extensionApi.RunError).exitCode;
console.error(`Subscription manager subscription activation check returned exit code: ${exitCode}`);
return exitCode;
}
}

export async function runSubscriptionManagerRegister(activationKeyName: string, orgId: string): Promise<number> {
export async function runSubscriptionManagerRegister(activationKeyName: string, orgId: string): Promise<number | undefined> {
try {
const result = await extensionApi.process.exec(getPodmanCli(), PODMAN_COMMANDS.SM_ACTIVATE_SUBS(activationKeyName, orgId));
return 0;
} catch (err) {
const exitCode = (err as extensionApi.RunError).exitCode;
console.error(`Subscription manager registration returned exit code: ${exitCode}`);
return exitCode;
}
}

export async function restartPodmanMachine() {
Expand Down

0 comments on commit ae3b5a0

Please sign in to comment.