@@ -414,48 +414,50 @@ public KicsRealtimeResults kicsRealtimeScan(@NonNull String fileSources, String
414414 return Execution .executeCommand (withConfigArguments (arguments ), logger , KicsRealtimeResults ::fromLine );
415415 }
416416
417- // public <T> T realtimeScan(@NonNull String subCommand, @NonNull String sourcePath, String containerTool, String ignoredFilePath, java.util.function.Function<String, T> resultParser)
418417 public String checkEngineExist (@ NonNull String engineName ) throws CxException , IOException , InterruptedException {
419418 String osName = System .getProperty ("os.name" ).toLowerCase (Locale .ENGLISH );
420419 String osType =Execution .getOperatingSystemType (osName );
421420 return this .checkEngine (engineName ,osType );
422421 }
423422
423+ private String verifyEngineOnMAC (String engineName ,List <String >arguments ) throws CxException , IOException , InterruptedException {
424+ Exception lastException = null ;
425+ String enginePath ;
426+ try {
427+ enginePath = Execution .executeCommand ((arguments ), logger , line ->line );
428+ return enginePath ;
429+ } catch (CxException | IOException e ) {
430+ lastException = e ;
431+ }
432+ Path dockerPath = Paths .get (CxConstants .DOCKER_FALLBACK_PATH );
433+ Path podmanPath = Paths .get (CxConstants .PODMAN_FALLBACK_PATH );
434+ if (CxConstants .DOCKER .equalsIgnoreCase (engineName )) {
435+ if (Files .isSymbolicLink (dockerPath )) {
436+ return Files .readSymbolicLink (dockerPath ).toAbsolutePath ().toString ();
437+ }
438+ else { return dockerPath .toAbsolutePath ().toString (); }
439+ }
440+ else if (CxConstants .PODMAN .equalsIgnoreCase (engineName )) {
441+ if (Files .exists (podmanPath )) {
442+ if (Files .isSymbolicLink (podmanPath )) {
443+ return Files .readSymbolicLink (podmanPath ).toAbsolutePath ().toString ();
444+ }
445+ else {
446+ return podmanPath .toAbsolutePath ().toString ();
447+ }
448+ }
449+ }
450+ throw new CxException ( 1 , "Engine '" + engineName + "' is not installed or not symlinked to /usr/local/bin." );
451+ }
452+
424453 private String checkEngine (String engineName , String osType ) throws CxException , IOException , InterruptedException {
425454 List <String > arguments = new ArrayList <>();
426455 switch (osType ){
427456 case OS_MAC :
428- String enginePath ;
429457 arguments .add ("/bin/sh" );
430458 arguments .add ("-c" );
431459 arguments .add ("command -v " + engineName );
432- Exception lastException = null ;
433- try {
434- enginePath = Execution .executeCommand ((arguments ), logger , line ->line );
435- return enginePath ;
436- } catch (CxException | IOException e ) {
437- lastException = e ;
438- }
439- Path dockerPath = Paths .get ("/usr/local/bin/docker" );
440- Path podmanPath = Paths .get ("/usr/local/bin/podman" );
441- if ("docker" .equalsIgnoreCase (engineName )) {
442- if (Files .isSymbolicLink (dockerPath )) {
443- return Files .readSymbolicLink (dockerPath ).toAbsolutePath ().toString ();
444- }
445- else { return dockerPath .toAbsolutePath ().toString (); }
446- }
447- else if ("podman" .equalsIgnoreCase (engineName )) {
448- if (Files .exists (podmanPath )) {
449- if (Files .isSymbolicLink (podmanPath )) {
450- return Files .readSymbolicLink (podmanPath ).toAbsolutePath ().toString ();
451- }
452- else {
453- return podmanPath .toAbsolutePath ().toString ();
454- }
455- }
456- }
457- throw new CxException ( 1 , "Engine '" + engineName + "' is not installed or not symlinked to /usr/local/bin." );
458-
460+ return verifyEngineOnMAC (engineName ,arguments );
459461 case OS_WINDOWS :
460462 case OS_LINUX :
461463 arguments .add (engineName );
@@ -560,7 +562,7 @@ public List<LearnMore> learnMore(String queryId) throws CxException, IOException
560562
561563 public boolean ideScansEnabled () throws CxException , IOException , InterruptedException {
562564 List <TenantSetting > tenantSettings = tenantSettings ();
563- if (tenantSettings == null ) {
565+ if (tenantSettings == null || tenantSettings . isEmpty () ) {
564566 throw new CxException (1 , "Unable to parse tenant settings" );
565567 }
566568 return tenantSettings .stream ()
0 commit comments