Skip to content

Commit

Permalink
Merge pull request #104 from OpenDataSpace/JENKINS-28815
Browse files Browse the repository at this point in the history
[JENKINS-28815] Providing nodes by "Image name" always works as by "Image ID"
  • Loading branch information
felfert committed Oct 8, 2015
2 parents 686a366 + 247b141 commit c36d740
Show file tree
Hide file tree
Showing 2 changed files with 211 additions and 141 deletions.
Expand Up @@ -219,19 +219,23 @@ static ComputeServiceContext ctx(String providerName, String identity, String cr
.buildView(ComputeServiceContext.class);
}

public ComputeService newCompute() {
Properties overrides = new Properties();
if (!Strings.isNullOrEmpty(this.endPointUrl)) {
overrides.setProperty(Constants.PROPERTY_ENDPOINT, this.endPointUrl);
}
if (scriptTimeout > 0) {
overrides.setProperty(ComputeServiceProperties.TIMEOUT_SCRIPT_COMPLETE, String.valueOf(scriptTimeout));
}
if (startTimeout > 0) {
overrides.setProperty(ComputeServiceProperties.TIMEOUT_NODE_RUNNING, String.valueOf(startTimeout));
}
return ctx(this.providerName, this.identity, Secret.toString(credential), overrides, this.zones).getComputeService();
}

public ComputeService getCompute() {
if (this.compute == null) {
Properties overrides = new Properties();
if (!Strings.isNullOrEmpty(this.endPointUrl)) {
overrides.setProperty(Constants.PROPERTY_ENDPOINT, this.endPointUrl);
}
if (scriptTimeout > 0) {
overrides.setProperty(ComputeServiceProperties.TIMEOUT_SCRIPT_COMPLETE, String.valueOf(scriptTimeout));
}
if (startTimeout > 0) {
overrides.setProperty(ComputeServiceProperties.TIMEOUT_NODE_RUNNING, String.valueOf(startTimeout));
}
this.compute = ctx(this.providerName, this.identity, Secret.toString(credential), overrides, this.zones).getComputeService();
this.compute = newCompute();
}
return compute;
}
Expand Down Expand Up @@ -321,7 +325,7 @@ public JCloudsSlaveTemplate getTemplate(Label label) {
return null;
}

JCloudsSlave doProvisionFromTemplate(final JCloudsSlaveTemplate t) throws IOException {
JCloudsSlave doProvisionFromTemplate(final JCloudsSlaveTemplate t) throws IOException {
final StringWriter sw = new StringWriter();
final StreamTaskListener listener = new StreamTaskListener(sw);
JCloudsSlave node = t.provisionSlave(listener);
Expand Down Expand Up @@ -393,11 +397,11 @@ public String getDisplayName() {
public FormValidation doTestConnection(@QueryParameter String providerName, @QueryParameter String identity, @QueryParameter String credential,
@QueryParameter String cloudGlobalKeyId, @QueryParameter String endPointUrl, @QueryParameter String zones) throws IOException {
if (identity == null)
return FormValidation.error("Invalid (AccessId).");
return FormValidation.error("Invalid (AccessId).");
if (credential == null)
return FormValidation.error("Invalid credential (secret key).");
return FormValidation.error("Invalid credential (secret key).");
if (null == Util.fixEmptyAndTrim(cloudGlobalKeyId)) {
return FormValidation.error("Cloud RSA key is not specified.");
return FormValidation.error("Cloud RSA key is not specified.");
}

// Remove empty text/whitespace from the fields.
Expand Down

0 comments on commit c36d740

Please sign in to comment.