Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/odo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface Odo {
describeComponent(contextPath: string, experimental?: boolean): Promise<ComponentDescription | undefined>;
analyze(contextPath: string): Promise<AnalyzeResponse[]>;
canCreatePod(): Promise<boolean>;
isPodmanPresent(): Promise<boolean>;

/**
* Returns the URL of the API of the current active cluster,
Expand Down Expand Up @@ -343,6 +344,18 @@ export class OdoImpl implements Odo {
}
return false;
}

public async isPodmanPresent(): Promise<boolean> {
try {
const result: cliInstance.CliExitData = await this.execute(Command.printOdoVersionJson());
if ('podman' in JSON.parse(result.stdout)) {
return true;
}
} catch {
//ignore
}
return false;
}
}

export function getInstance(): Odo {
Expand Down
4 changes: 4 additions & 0 deletions src/odo/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export class Command {
return new CommandText('odo version');
}

static printOdoVersionJson(): CommandText {
return new CommandText('odo version -o json');
}

static odoLogout(): CommandText {
return new CommandText('odo logout');
}
Expand Down
11 changes: 10 additions & 1 deletion src/openshift/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,16 @@ export class Component extends OpenShiftItem {

@vsCommand('openshift.component.dev.onPodman')
static async devOnPodman(component: ComponentWorkspaceFolder) {
return Component.devRunOn(component, 'podman');
if (await Component.odo.isPodmanPresent()) {
return Component.devRunOn(component, 'podman');
}
void window.showErrorMessage('Podman is not present in the system, please install podman on your machine and try again.', 'Install podman')
.then(async (result) => {
if (result === 'Install podman') {
await commands.executeCommand('vscode.open', Uri.parse('https://podman.io/'));
}
});
return;
}

@vsCommand('openshift.component.binding.add')
Expand Down