Skip to content

Commit bbd3c3d

Browse files
Merge pull request fabric8io#614 from rhuss/master
PR merged! Thanks!
2 parents 1c3213b + d631940 commit bbd3c3d

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

plugin/src/main/java/io/fabric8/maven/plugin/mojo/infra/AbstractInstallMojo.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package io.fabric8.maven.plugin.mojo.infra;
1717

18+
import io.fabric8.maven.core.config.PlatformMode;
1819
import io.fabric8.maven.core.util.IoUtil;
1920
import io.fabric8.maven.core.util.ProcessUtil;
2021
import io.fabric8.maven.plugin.mojo.AbstractFabric8Mojo;
@@ -58,6 +59,13 @@ private enum Architecture { amd64, arm }
5859
@Parameter(property = "fabric8.cluster.kind")
5960
protected String clusterKind;
6061

62+
/**
63+
* Alternatively, the platform mode is evaluated to detect the kind of cluster
64+
* to use. 'clusterKind' takes precedence
65+
*/
66+
@Parameter(property = "fabric8.mode")
67+
protected PlatformMode mode;
68+
6169
@Parameter(property = "fabric8.dir", defaultValue = "${user.home}/.fabric8/bin")
6270
private File fabric8BinDir;
6371

@@ -297,7 +305,10 @@ protected boolean isMinishift() {
297305
if (Strings.isNotBlank(clusterKind)) {
298306
String text = clusterKind.toLowerCase().trim();
299307
return text.equals("minishift") || text.equals("openshift");
308+
} else if (mode != null && mode == PlatformMode.openshift) {
309+
return true;
310+
} else {
311+
return false;
300312
}
301-
return false;
302313
}
303314
}

plugin/src/main/java/io/fabric8/maven/plugin/mojo/infra/ClusterStartMojo.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public class ClusterStartMojo extends AbstractInstallMojo {
5454
* Which VM Driver do you wish to use such as
5555
* <code>hyperv</code>, <code>xhyve</code>, <code>kvm</code>, <code>virtualbox</code>, <code>vmwarefusion</code>
5656
*/
57-
@Parameter(property = "fabric8.vm.driver")
58-
private String vmDriver;
57+
@Parameter(property = "fabric8.cluster.driver")
58+
private String clusterDriver;
5959

6060

6161
@Override
@@ -64,13 +64,11 @@ public void executeInternal() throws MojoExecutionException, MojoFailureExceptio
6464

6565
ArrayList<String> arguments = new ArrayList<>();
6666
arguments.add("start");
67-
if (Strings.isNotBlank(clusterKind)) {
68-
if (isMinishift()) {
69-
arguments.add("--minishift");
70-
} else {
71-
// lets assume its valid and let gofabric8 fail
72-
arguments.add("--" + clusterKind);
73-
}
67+
if (isMinishift()) {
68+
arguments.add("--minishift");
69+
} else if (Strings.isNotBlank(clusterKind)) {
70+
// lets assume its valid and let gofabric8 fail
71+
arguments.add("--" + clusterKind);
7472
}
7573
if (!clusterApp.equals("fabric8") && !clusterApp.equals("platform")) {
7674
arguments.add("--" + clusterApp);
@@ -79,9 +77,9 @@ public void executeInternal() throws MojoExecutionException, MojoFailureExceptio
7977
// TODO add --app= CLI argument when gofabric8 start supports it
8078
// see https://github.com/fabric8io/gofabric8/issues/224
8179
}
82-
if (Strings.isNotBlank(vmDriver)) {
80+
if (Strings.isNotBlank(clusterDriver)) {
8381
arguments.add("--vm-driver");
84-
arguments.add(vmDriver);
82+
arguments.add(clusterDriver);
8583
}
8684
if (Strings.isNotBlank(clusterCPUs)) {
8785
arguments.add("--cpus");

0 commit comments

Comments
 (0)