提交 e8f2002c 编写于 作者: S Stephen Connolly

[FIXED JENKINS-31591] Correct MasterKillSwitchConfiguration visibility

- 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.
上级 b23b3cfa
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.
*
......@@ -47,8 +46,13 @@ public class MasterKillSwitchConfiguration extends GlobalConfiguration {
* 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
)
;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册