简体   繁体   中英

Set 'Enable Slave → Master Access Control' from script console

How can I toggle on Jenkins' Enable Slave -> Master Access Control (listed under Configure System), control from a Groovy script run using the script console?

I suspect the answer will involve the MasterKillSwitchConfiguration class.

Answer is:

Jenkins.instance.injector.getInstance(AdminWhitelistRule.class)
    .setMasterKillSwitch(false);
Jenkins.instance.save()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM