Class: Chimp::ExecReport
- Defined in:
- lib/right_chimp/exec/exec_report.rb
Constant Summary
Constants inherited from Executor
Chimp::Executor::STATUS_DONE, Chimp::Executor::STATUS_ERROR, Chimp::Executor::STATUS_HOLDING, Chimp::Executor::STATUS_NONE, Chimp::Executor::STATUS_RETRYING, Chimp::Executor::STATUS_RUNNING
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#server ⇒ Object
Returns the value of attribute server.
Attributes inherited from Executor
#array, #concurrency, #delay, #dry_run, #error, #exec, #group, #inputs, #job_id, #job_notes, #job_uuid, #owner, #quiet, #results, #retry_count, #retry_sleep, #status, #template, #time_end, #time_start, #timeout, #verbose
Instance Method Summary collapse
Methods inherited from Executor
#cancel, #get_total_exec_time, #initialize, #queue, #requeue, #target
Constructor Details
This class inherits a constructor from Chimp::Executor
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
10 11 12 |
# File 'lib/right_chimp/exec/exec_report.rb', line 10 def fields @fields end |
#server ⇒ Object
Returns the value of attribute server.
10 11 12 |
# File 'lib/right_chimp/exec/exec_report.rb', line 10 def server @server end |
Instance Method Details
#info ⇒ Object
13 14 15 |
# File 'lib/right_chimp/exec/exec_report.rb', line 13 def info return "report on server #{fields.inspect}" end |
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/right_chimp/exec/exec_report.rb', line 17 def run run_with_retry do output = [] begin s=@server Log.debug "Making API 1.5 call: client.tags" response=Connection.client..by_resource(:resource_hrefs => [@server.href]).first. rescue Exception => ex raise e s = @server response = nil end s.params["tags"] = [] unless s.params["tags"] response.each do |t| s.params["tags"] += [ t['name'] ] end @fields.split(",").each do |f| if f =~ /^tag=([^,]+)/ tag_search_string = $1 s.params["tags"].each do |tag| output << tag if tag =~ /^#{tag_search_string}/ end else output << s.params[f] end end puts output.join(",") end end |