Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2828 from sathiya-mit/master
[JENKINS-42852] - Jenkins Configuration Save Option
(cherry picked from commit 77804c1)
  • Loading branch information
oleg-nenashev authored and olivergondza committed May 2, 2017
1 parent 6128459 commit ce7d2ae
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -27,6 +27,7 @@
import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import jenkins.model.GlobalConfiguration;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand All @@ -41,9 +42,15 @@
public class AdministrativeMonitorsConfiguration extends GlobalConfiguration {
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
JSONArray monitors = json.optJSONArray("administrativeMonitor");
for (AdministrativeMonitor am : AdministrativeMonitor.all()) {
try {
boolean disable = !json.getJSONArray("administrativeMonitor").contains(am.id);
boolean disable;
if(monitors != null) {
disable = !monitors.contains(am.id);
}else {
disable = !am.id.equals(json.optString("administrativeMonitor"));
}
am.disable(disable);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to process form submission for " + am.id, e);
Expand Down

0 comments on commit ce7d2ae

Please sign in to comment.