Closed russroy closed 9 years ago
Ok ... I figured it out:
require 'java'
require 'rundeck-api-java-client-13.1-SNAPSHOT-jar-with-dependencies.jar'
import org.rundeck.api.RundeckClient
import org.rundeck.api.RundeckJobsImportBuilder
import org.rundeck.api.FileType
rundeck = RundeckClient.builder().url("http://10.0.2.15:4440").login("*****", "********").build()
importer = RundeckJobsImportBuilder.builder().setFileType(Java::OrgRundeckApi::FileType::YAML).build()
Dir["./*.yml"].each do | filename |
puts "Processing filename=#{filename}"
result = rundeck.importJobs(filename, importer)
puts "#{result.succeededJobs.size} jobs successfully imported, #{result.skippedJobs.size} jobs skipped, and #{result.failedJobs.size} jobs failed"
end
thanks, we should update the jruby examples
A simple JRuby script to import jobs to my rundeck instance....
Fails with:
Apparently the api has changed. The examples document here http://vincent.behar.name/rundeck-api-java-client/ are out of date.
Looks as though the importJobs api has changed to use a RundeckJobsImport object (??)
Not being a java programmer I'm unclear as to how to properly build the args in JRuby to do my import.