Support 'debug' parameter in Astute message

Before this change Nailgun send Astute info about debug
mode for task in case of task deployment in every task.
After this change it will send once in main message.
Astute setup it by itself.

Change-Id: I3fee53978e652009b1ef2f7868525d65a113ab01
Closes-Bug: #1618774
This commit is contained in:
Vladimir Sharshov (warpc) 2016-09-01 20:19:56 +03:00 committed by Vladimir Sharshov
parent c33fe77e77
commit f4872de290
3 changed files with 18 additions and 2 deletions

View File

@ -93,7 +93,8 @@ module Astute
:tasks_directory => data['args'].fetch('tasks_directory', {}),
:tasks_metadata => data['args'].fetch('tasks_metadata', {}),
:dry_run => data['args'].fetch('dry_run', false),
:noop_run => data['args'].fetch('noop_run', false)
:noop_run => data['args'].fetch('noop_run', false),
:debug => data['args'].fetch('debug', false)
}
)
rescue Timeout::Error

View File

@ -15,7 +15,7 @@ require 'fuel_deployment'
module Astute
class TaskCluster < Deployment::Cluster
attr_accessor :noop_run
attr_accessor :noop_run, :debug_run
def initialize(id=nil)
super

View File

@ -49,6 +49,7 @@ module Astute
[]
)
cluster.noop_run = deployment_options.fetch(:noop_run, false)
cluster.debug_run = deployment_options.fetch(:debug, false)
cluster.node_statuses_transitions = tasks_metadata.fetch(
'node_statuses_transitions',
@ -70,6 +71,7 @@ module Astute
end
setup_fail_behavior(tasks_graph, cluster)
setup_debug_behavior(tasks_graph, cluster)
setup_tasks(tasks_graph, cluster)
setup_task_depends(tasks_graph, cluster)
setup_task_concurrency(tasks_graph, cluster)
@ -117,6 +119,19 @@ module Astute
end
end
def setup_debug_behavior(tasks_graph, cluster)
return unless cluster.debug_run
tasks_graph.each do |node_id, tasks|
tasks.each do |task|
if task['parameters'].present?
task['parameters']['debug'] = true
else
task['parameters'] = { 'debug' => true }
end
end
end
end
def setup_tasks(tasks_graph, cluster)
tasks_graph.each do |node_id, tasks|
tasks.each do |task|