Skip to content

Commit f0abfce

Browse files
committed
#225 - corrects for the actual output from the Groovy script
1 parent 7423038 commit f0abfce

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/jenkins_api_client/job.rb

+6-7
Original file line numberDiff line numberDiff line change
@@ -703,17 +703,16 @@ def builder = new groovy.json.JsonBuilder(allInfo)
703703
EOS
704704

705705
response_json = groovy_script_output
706-
707706
jobs = Array.new
708-
response_json["jobs"].each do |job|
709-
if job.is_a?(Hash)
710-
if job.key? :_class and job[:_class] !~ /com.cloudbees.hudson.plugins.folder.Folder/
707+
JSON.parse(response_json).each do |job|
708+
if job.is_a?(Hash)
709+
if job.key? "_class" and job["_class"] !~ /com.cloudbees.hudson.plugins.folder.Folder/
711710
if ignorecase
712-
jobs << job[:name] if job[:name] =~ /#{filter}/i
711+
jobs << job["name"] if job["name"] =~ /#{filter}/i
713712
else
714-
jobs << job[:name] if job[:name] =~ /#{filter}/
713+
jobs << job["name"] if job["name"] =~ /#{filter}/
715714
end
716-
end
715+
end
717716
end
718717
end
719718
jobs.to_a

0 commit comments

Comments
 (0)