Skip to content

Commit

Permalink
[FIXED JENKINS-31591] Correct MasterKillSwitchConfiguration visibility
Browse files Browse the repository at this point in the history
- The MasterKillSwitchConfiguration was not available when you have clouds but no fixed slaves.
- The MasterKillSwitchConfiguration was not available when it was enabled but for a non-relevant configuration.
  • Loading branch information
stephenc committed Nov 17, 2015
1 parent b23b3cf commit e8f2002
Showing 1 changed file with 8 additions and 4 deletions.
@@ -1,14 +1,13 @@
package jenkins.security.s2m;

import hudson.Extension;
import javax.inject.Inject;
import jenkins.model.GlobalConfiguration;
import jenkins.model.GlobalConfigurationCategory;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;

import javax.inject.Inject;

/**
* Exposes {@link AdminWhitelistRule#masterKillSwitch} to the admin.
*
Expand Down Expand Up @@ -47,8 +46,13 @@ public boolean configure(StaplerRequest req, JSONObject json) throws FormExcepti
* Unless this option is relevant, we don't let users choose this.
*/
public boolean isRelevant() {
return jenkins.getComputers().length>1 // if there's no slave, there's no point
&& jenkins.isUseSecurity() // if security is off, likewise this is pointless
if (rule.getMasterKillSwitch()) {
return true; // always relevant if it is enabled.
}
return jenkins.isUseSecurity() // if security is off, there's no point
&& (jenkins.getComputers().length>1 // if there's no slave,
|| !jenkins.clouds.isEmpty() // and no clouds, likewise this is pointless
)
;
}
}
Expand Down

0 comments on commit e8f2002

Please sign in to comment.