Skip to content

Commit

Permalink
Merge pull request #255 from arangamani/chinolatte-node_list_needs_sl…
Browse files Browse the repository at this point in the history
…aveonly_option

Chinolatte node list needs slaveonly option
  • Loading branch information
katelovescode committed Nov 27, 2017
2 parents ac6f96a + 1ceed07 commit 5686bce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Jenkins API Client
[gemnasium]: https://gemnasium.com/arangamani/jenkins_api_client
[codeclimate]: https://codeclimate.com/github/arangamani/jenkins_api_client

Copyright © 2012-2013, Kannan Manickam [![endorse](http://api.coderwall.com/arangamani/endorsecount.png)](http://coderwall.com/arangamani)
Copyright © 2012-2017, Kannan Manickam [![endorse](http://api.coderwall.com/arangamani/endorsecount.png)](http://coderwall.com/arangamani)

Client libraries for communicating with a Jenkins CI server and programatically managing jobs.

Expand Down
6 changes: 4 additions & 2 deletions lib/jenkins_api_client/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,15 @@ def delete_all!
# @param [String] filter a regex to filter node names
# @param [Bool] ignorecase whether to be case sensitive or not
#
def list(filter = nil, ignorecase = true)
def list(filter = nil, ignorecase = true, slaveonly = false)
@logger.info "Obtaining nodes from jenkins matching filter '#{filter}'"
node_names = []
response_json = @client.api_get_request("/computer")
response_json["computer"].each do |computer|
if computer["displayName"] =~ /#{filter}/i
node_names << computer["displayName"]
unless slaveonly && computer["displayName"] == "master"
node_names << computer["displayName"]
end
end
end
node_names
Expand Down

0 comments on commit 5686bce

Please sign in to comment.