diff --git a/lib/vmfloaty/abs.rb b/lib/vmfloaty/abs.rb index 8c37072..42ba28a 100644 --- a/lib/vmfloaty/abs.rb +++ b/lib/vmfloaty/abs.rb @@ -233,7 +233,7 @@ class ABS (1..retries).each do |i| queue_place, res_body = check_queue(conn, saved_job_id, req_obj, verbose) - return translated(res_body) if res_body + return translated(res_body, saved_job_id) if res_body sleep_seconds = 10 if i >= 10 sleep_seconds = i if i < 10 @@ -247,8 +247,8 @@ class ABS # # We should fix the ABS API to be more like the vmpooler or nspooler api, but for now # - def self.translated(res_body) - vmpooler_formatted_body = {} + def self.translated(res_body, job_id) + vmpooler_formatted_body = {'job_id' => job_id} res_body.each do |host| if vmpooler_formatted_body[host['type']] && vmpooler_formatted_body[host['type']]['hostname'].class == Array diff --git a/lib/vmfloaty/utils.rb b/lib/vmfloaty/utils.rb index 2a4cbce..f262d9e 100644 --- a/lib/vmfloaty/utils.rb +++ b/lib/vmfloaty/utils.rb @@ -45,6 +45,10 @@ class Utils result = {} + # ABS has a job_id associated with hosts so pass that along + abs_job_id = response_body.delete('job_id') + result['job_id'] = abs_job_id unless abs_job_id.nil? + filtered_response_body = response_body.reject { |key, _| key == 'request_id' || key == 'ready' } filtered_response_body.each do |os, value| hostnames = Array(value['hostname']) @@ -57,7 +61,8 @@ class Utils def self.format_host_output(hosts) hosts.flat_map do |os, names| - names.map { |name| "- #{name} (#{os})" } + # Assume hosts are stored in Arrays and ignore everything else + names.map { |name| "- #{name} (#{os})" } if names.is_a? Array end.join("\n") end