Skip to content

Commit

Permalink
add get_num_executors()/set_num_executors() methods to puppet_helper
Browse files Browse the repository at this point in the history
These methods may be used to get/set the number of executors for the
master. Eg.:

    java -jar /usr/lib/jenkins/jenkins-cli.jar -s http://localhost:8080 groovy /usr/lib/jenkins/puppet_helper.groovy get_num_executors

    java -jar /usr/lib/jenkins/jenkins-cli.jar -s http://localhost:8080 groovy /usr/lib/jenkins/puppet_helper.groovy set_num_executors 42
  • Loading branch information
Joshua Hoblitt authored and jhoblitt committed May 2, 2015
1 parent 2e8325a commit df133b4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions files/puppet_helper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,30 @@ class Actions {
instance.setAuthorizationStrategy(strategy)
instance.setSecurityRealm(realm)
}

////////////////////////
// get_num_executors
////////////////////////
/*
* Print the number of executors for the master
*/
void get_num_executors() {
def j = Jenkins.getInstance()
def n = j.getNumExecutors()
out.println(n)
}

////////////////////////
// set_num_executors
////////////////////////
/*
* Set the number of executors for the master
*/
void set_num_executors(String n) {
def j = Jenkins.getInstance()
j.setNumExecutors(n.toInteger())
j.save()
}
} // class Actions

///////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit df133b4

Please # to comment.