use of org.apache.whirr.ClusterSpec in project whirr by apache.
the class BaseServiceDryRunTest method newClusterSpecForProperties.
protected ClusterSpec newClusterSpecForProperties(Map<String, String> properties) throws ConfigurationException, JSchException, IOException {
Configuration config = new PropertiesConfiguration();
config.setProperty("whirr.provider", "stub");
config.setProperty("whirr.cluster-name", "stub-test");
config.setProperty("whirr.state-store", "memory");
for (Entry<String, String> entry : properties.entrySet()) config.setProperty(entry.getKey(), entry.getValue());
// we don't want to create files
return new ClusterSpec(config) {
@Override
protected void checkAndSetKeyPair() {
setPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
setPublicKey("ssh-rsa AAAAB3NzaC1yc2EA");
}
};
}
use of org.apache.whirr.ClusterSpec in project whirr by apache.
the class TemplateUtilsTest method testProcessTemplate.
@Test
public void testProcessTemplate() throws Exception {
Credentials credentials = new Credentials("dummy", "dummy");
Cluster.Instance instance = new Cluster.Instance(credentials, Sets.newHashSet("foo"), "127.0.0.1", "127.0.0.1", "id-0", null);
ClusterSpec clusterSpec = ClusterSpec.withTemporaryKeys(new PropertiesConfiguration("whirr-core-test.properties"));
Cluster cluster = new Cluster(Sets.newHashSet(instance));
VelocityEngine ve = TemplateUtils.newVelocityEngine();
String result = TemplateUtils.processTemplate(ve, "template-test.txt.vm", clusterSpec, cluster);
Assert.assertEquals("instance ip: 127.0.0.1", result);
}
use of org.apache.whirr.ClusterSpec in project whirr by apache.
the class DestroyCluster method doExecute.
@Override
protected Object doExecute() throws Exception {
validateInput();
DestroyClusterCommand command = new DestroyClusterCommand(clusterControllerFactory);
ClusterSpec clusterSpec = getClusterSpec();
if (clusterSpec != null) {
command.run(System.in, System.out, System.err, clusterSpec);
}
return null;
}
use of org.apache.whirr.ClusterSpec in project whirr by apache.
the class LaunchCluster method doExecute.
@Override
protected Object doExecute() throws Exception {
validateInput();
LaunchClusterCommand command = new LaunchClusterCommand(clusterControllerFactory);
ClusterSpec clusterSpec = getClusterSpec();
if (clusterSpec != null) {
command.run(System.in, System.out, System.err, clusterSpec);
}
return null;
}
use of org.apache.whirr.ClusterSpec in project whirr by apache.
the class GangliaMetadClusterActionHandler method afterConfigure.
@Override
protected void afterConfigure(ClusterActionEvent event) {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
LOG.info("Completed configuration of {}", clusterSpec.getClusterName());
String hosts = Joiner.on(',').join(getHosts(cluster.getInstancesMatching(role(GANGLIA_METAD_ROLE))));
LOG.info("Meta host: {}. You should be able to connect on http://{}/ganglia", hosts, hosts);
}
Aggregations