Skip to content
This repository has been archived by the owner on Jun 22, 2018. It is now read-only.

Commit

Permalink
Do not restore version from running cluster.
Browse files Browse the repository at this point in the history
* When using a custom Docker image the cluster would not start since that version might not be recognized by minimesos cluster config. Therefore do not set the version of the runtime.
* On minimesos info print the version of the running cluster.
  • Loading branch information
frankscholten committed Jan 18, 2017
1 parent 051bdd2 commit 4918921
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public void execute() {
MesosCluster cluster = repository.loadCluster(new MesosClusterContainersFactory());
if (cluster != null) {
output.println("Minimesos cluster is running: " + cluster.getClusterId());
if (cluster.getMesosVersion() != null) {
output.println("Mesos version: " + cluster.getMesosVersion());
}
output.println("Mesos version: " + cluster.getMaster().getState().getVersion());
printServiceUrls(cluster);
} else {
output.println(String.format("Minimesos cluster %s is not running. %s is removed", clusterId, repository.getMinimesosFile().getAbsolutePath()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void testMesosVersionRestored() {
String clusterId = CLUSTER.getClusterId();
MesosCluster cluster = MesosCluster.loadCluster(clusterId, new MesosClusterContainersFactory());

Assert.assertEquals("1.0.0", cluster.getMesosVersion());
Assert.assertEquals("1.0.0", cluster.getConfiguredMesosVersion());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ClusterConfig extends GroovyBlock {

void setLoggingLevel(String loggingLevel) {
if (!StringUtils.equalsIgnoreCase(loggingLevel, "WARNING") && !StringUtils.equalsIgnoreCase(loggingLevel, "INFO") && !StringUtils.equalsIgnoreCase(loggingLevel, "ERROR")) {
throw new RuntimeException("Property 'loggingLevel' can only have the values INFO, WARNING or ERROR")
throw new RuntimeException("Property 'loggingLevel' can only have the values INFO, WARNING or ERROR. Got '" + loggingLevel + "'")
}
this.loggingLevel = loggingLevel.toUpperCase()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,17 @@ public String getLoggingLevel() {
}

/**
* @return configured or default Mesos version of all Mesos containers in the cluster
* @return Mesos version that is configured
*/
public String getMesosVersion() {
public String getConfiguredMesosVersion() {
return clusterConfig.getMesosVersion();
}

public void setMesosVersion(String version) {
clusterConfig.setMesosVersion(version);
/**
* @return Mesos version of running cluster
*/
public String getMesosVersion() {
return getMaster().getState().getVersion();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MesosAgentContainer extends MesosContainerImpl implements MesosAgen
private final static String MESOS_AGENT_SANDBOX_DIR = "/tmp/mesos";

public MesosAgentContainer(MesosCluster cluster, String uuid, String containerId) {
this(cluster, uuid, containerId, new MesosAgentConfig(cluster.getMesosVersion()));
this(cluster, uuid, containerId, new MesosAgentConfig(cluster.getConfiguredMesosVersion()));
}

private MesosAgentContainer(MesosCluster cluster, String uuid, String containerId, MesosAgentConfig config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public void loadRunningCluster(MesosCluster cluster) {
containers.add(master);

restoreMapToPorts(cluster, container);
restoreMesosVersion(cluster, master);
break;
case "marathon":
containers.add(createMarathon(cluster, uuid, containerId));
Expand All @@ -111,11 +110,6 @@ public void loadRunningCluster(MesosCluster cluster) {
}
}

private void restoreMesosVersion(MesosCluster cluster, MesosMaster master) {
String mesosVersion = master.getState().getVersion();
cluster.setMesosVersion(mesosVersion);
}

private void restoreMapToPorts(MesosCluster cluster, Container container) {
// Restore "map ports to host" attribute
ContainerPort[] ports = container.getPorts();
Expand Down

0 comments on commit 4918921

Please sign in to comment.