File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ export interface Odo {
7070 describeComponent ( contextPath : string , experimental ?: boolean ) : Promise < ComponentDescription | undefined > ;
7171 analyze ( contextPath : string ) : Promise < AnalyzeResponse [ ] > ;
7272 canCreatePod ( ) : Promise < boolean > ;
73+ isPodmanPresent ( ) : Promise < boolean > ;
7374
7475 /**
7576 * Returns the URL of the API of the current active cluster,
@@ -343,6 +344,18 @@ export class OdoImpl implements Odo {
343344 }
344345 return false ;
345346 }
347+
348+ public async isPodmanPresent ( ) : Promise < boolean > {
349+ try {
350+ const result : cliInstance . CliExitData = await this . execute ( Command . printOdoVersionJson ( ) ) ;
351+ if ( 'podman' in JSON . parse ( result . stdout ) ) {
352+ return true ;
353+ }
354+ } catch {
355+ //ignore
356+ }
357+ return false ;
358+ }
346359}
347360
348361export function getInstance ( ) : Odo {
Original file line number Diff line number Diff line change @@ -160,6 +160,10 @@ export class Command {
160160 return new CommandText ( 'odo version' ) ;
161161 }
162162
163+ static printOdoVersionJson ( ) : CommandText {
164+ return new CommandText ( 'odo version -o json' ) ;
165+ }
166+
163167 static odoLogout ( ) : CommandText {
164168 return new CommandText ( 'odo logout' ) ;
165169 }
Original file line number Diff line number Diff line change @@ -204,7 +204,16 @@ export class Component extends OpenShiftItem {
204204
205205 @vsCommand ( 'openshift.component.dev.onPodman' )
206206 static async devOnPodman ( component : ComponentWorkspaceFolder ) {
207- return Component . dev ( component , 'podman' ) ;
207+ if ( await Component . odo . isPodmanPresent ( ) ) {
208+ return Component . dev ( component , 'podman' ) ;
209+ }
210+ void window . showErrorMessage ( 'Podman is not present in the system, please install podman on your machine and try again.' , 'Install podman' )
211+ . then ( async ( result ) => {
212+ if ( result === 'Install podman' ) {
213+ await commands . executeCommand ( 'vscode.open' , Uri . parse ( 'https://podman.io/' ) ) ;
214+ }
215+ } ) ;
216+ return ;
208217 }
209218
210219 @vsCommand ( 'openshift.component.binding.add' )
You can’t perform that action at this time.
0 commit comments