Skip to content
Permalink
Browse files
[FIXED JENKINS-8946] Option to set Zone as well as region for instanc…
…e creation (removed zone from slave instance)
  • Loading branch information
francisu committed Feb 22, 2012
1 parent f0e542f commit 9e89c6c1914253693be02f5feb3f1e9228863a71
Showing 3 changed files with 7 additions and 23 deletions.
@@ -38,7 +38,6 @@ public final class EC2Slave extends Slave {
/**
* Comes from {@link SlaveTemplate#initScript}.
*/
public final String zone;
public final String initScript;
public final String remoteAdmin; // e.g. 'ubuntu'
public final String rootCommandPrefix; // e.g. 'sudo'
@@ -51,14 +50,13 @@ public final class EC2Slave extends Slave {

public static final String TEST_ZONE = "testZone";

public EC2Slave(String instanceId, String description, String zone, String remoteFS, int sshPort, int numExecutors, String labelString, String initScript, String remoteAdmin, String rootCommandPrefix, String jvmopts) throws FormException, IOException {
this(instanceId, description, zone, remoteFS, sshPort, numExecutors, Mode.NORMAL, labelString, initScript, Collections.<NodeProperty<?>>emptyList(), remoteAdmin, rootCommandPrefix, jvmopts);
public EC2Slave(String instanceId, String description, String remoteFS, int sshPort, int numExecutors, String labelString, String initScript, String remoteAdmin, String rootCommandPrefix, String jvmopts) throws FormException, IOException {
this(instanceId, description, remoteFS, sshPort, numExecutors, Mode.NORMAL, labelString, initScript, Collections.<NodeProperty<?>>emptyList(), remoteAdmin, rootCommandPrefix, jvmopts);
}

@DataBoundConstructor
public EC2Slave(String instanceId, String description, String zone, String remoteFS, int sshPort, int numExecutors, Mode mode, String labelString, String initScript, List<? extends NodeProperty<?>> nodeProperties, String remoteAdmin, String rootCommandPrefix, String jvmopts) throws FormException, IOException {
public EC2Slave(String instanceId, String description, String remoteFS, int sshPort, int numExecutors, Mode mode, String labelString, String initScript, List<? extends NodeProperty<?>> nodeProperties, String remoteAdmin, String rootCommandPrefix, String jvmopts) throws FormException, IOException {
super(instanceId, description, remoteFS, numExecutors, mode, labelString, new EC2UnixLauncher(), new EC2RetentionStrategy(), nodeProperties);
this.zone = zone;
this.initScript = initScript;
this.remoteAdmin = remoteAdmin;
this.rootCommandPrefix = rootCommandPrefix;
@@ -70,7 +68,7 @@ public EC2Slave(String instanceId, String description, String zone, String remot
* Constructor for debugging.
*/
public EC2Slave(String instanceId) throws FormException, IOException {
this(instanceId,"debug","zone", "/tmp/hudson", 22, 1, Mode.NORMAL, "debug", "", Collections.<NodeProperty<?>>emptyList(), null, null, null);
this(instanceId,"debug", "/tmp/hudson", 22, 1, Mode.NORMAL, "debug", "", Collections.<NodeProperty<?>>emptyList(), null, null, null);
}

/**
@@ -122,10 +120,6 @@ public void terminate() {
}
}

String getZone() {
return zone;
}

String getRemoteAdmin() {
if (remoteAdmin == null || remoteAdmin.length() == 0)
return "root";
@@ -161,7 +161,7 @@ public EC2Slave provision(TaskListener listener) throws AmazonClientException, I
}

private EC2Slave newSlave(Instance inst) throws FormException, IOException {
return new EC2Slave(inst.getInstanceId(), description, getZone(), remoteFS, getSshPort(), getNumExecutors(), labels, initScript, remoteAdmin, rootCommandPrefix, jvmopts);
return new EC2Slave(inst.getInstanceId(), description, remoteFS, getSshPort(), getNumExecutors(), labels, initScript, remoteAdmin, rootCommandPrefix, jvmopts);
}

/**
@@ -47,16 +47,6 @@ THE SOFTWARE.
<f:textbox />
</f:entry>

<f:entry title="${%Availability Zone}" field="zone">
<!-- this is preferred but there is a problem with making it work FRU 22 Feb 12 -->
<!-- <f:select/>-->
<f:textbox/>
</f:entry>

<f:entry title="${%Remote FS root}" field="remoteFS">
<f:textbox />
</f:entry>

<f:entry title="${%Labels}" field="labelString">
<f:textbox />
</f:entry>
@@ -65,8 +55,6 @@ THE SOFTWARE.
<f:textarea />
</f:entry>

<f:descriptorList title="${%Node Properties}" descriptors="${h.getNodePropertyDescriptors(descriptor.clazz)}" field="nodeProperties" />

<f:entry title="${%Remote user}" field="remoteAdmin">
<f:textbox />
</f:entry>
@@ -75,6 +63,8 @@ THE SOFTWARE.
<f:textbox />
</f:entry>

<f:descriptorList title="${%Node Properties}" descriptors="${h.getNodePropertyDescriptors(descriptor.clazz)}" field="nodeProperties" />

<f:block>
<f:submit value="${%Save}"/>
</f:block>

0 comments on commit 9e89c6c

Please sign in to comment.