Skip to content

Commit

Permalink
fixed JENKINS-14420:
Browse files Browse the repository at this point in the history
removed buggy jelly inputs and default site selection
  • Loading branch information
edmund-wagner committed Sep 3, 2012
1 parent 1c2b3aa commit ada65c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
23 changes: 10 additions & 13 deletions src/main/java/org/jvnet/hudson/plugins/SSHBuildWrapper.java
Expand Up @@ -11,6 +11,7 @@
import hudson.tasks.BuildWrapperDescriptor;
import hudson.util.CopyOnWriteList;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -42,13 +43,6 @@ public SSHBuildWrapper() {

@DataBoundConstructor
public SSHBuildWrapper(String siteName, String preScript, String postScript) {
if (siteName == null) {
// defaults to the first one
SSHSite[] sites = DESCRIPTOR.getSites();
if (sites.length > 0){
siteName = sites[0].getSitename();
}
}
this.siteName = siteName;
this.preScript = preScript;
this.postScript = postScript;
Expand Down Expand Up @@ -118,9 +112,6 @@ public void setPostScript(String postScript) {

public SSHSite getSite() {
SSHSite[] sites = DESCRIPTOR.getSites();
if (siteName == null && sites.length > 0){
return sites[0]; // default
}

for (SSHSite site : sites) {
if (site.getSitename().equals(siteName))
Expand Down Expand Up @@ -153,6 +144,14 @@ protected DescriptorImpl(Class<? extends BuildWrapper> clazz) {
public String getDisplayName() {
return Messages.SSH_DisplayName();
}

public ListBoxModel doFillSiteNameItems() {
ListBoxModel m = new ListBoxModel();
for (SSHSite site : SSHBuildWrapper.DESCRIPTOR.getSites()) {
m.add(site.getSitename());
}
return m;
}

public String getShortName() {
return "[SSH] ";
Expand All @@ -165,9 +164,7 @@ public String getHelpFile() {

@Override
public BuildWrapper newInstance(StaplerRequest req, JSONObject formData) {
SSHBuildWrapper pub = new SSHBuildWrapper();
req.bindParameters(pub, "ssh.");
return pub;
return req.bindJSON(clazz, formData);
}

public SSHSite[] getSites() {
Expand Down
@@ -1,12 +1,8 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

<j:set var="helpURL" value="/plugin/ssh" />
<f:entry title="${%SSH site}">
<select class="setting-input" name="ssh.siteName" help="${helpURL}/help-hostselect.html">
<j:forEach var="s" items="${descriptor.sites}">
<f:option selected="${s.name==instance.siteName}">${s.sitename}</f:option>
</j:forEach>
</select>
<f:entry title="${%SSH site}" field="siteName" name="ssh.siteName">
<f:select />
</f:entry>

<f:entry title="${%Pre build script}" help="${helpURL}/help-prescript.html">
Expand Down

0 comments on commit ada65c3

Please sign in to comment.