summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Ilyin <dilyin@mirantis.com>2016-09-22 16:09:41 -0500
committerDmitry Ilyin <dilyin@mirantis.com>2016-09-22 16:09:41 -0500
commite99a094b98851b4bd0473bfba159181fbf36a073 (patch)
tree544eff61fd5d5adec1f947cb9fac359aa0ecbc89
parentca9bf7523164abaadc14266abc477dfb0c81aaf8 (diff)
Add custom find functions for graph and metadata
Notes
Notes (review): Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+2: Dmitry Ilyin <dilyin@mirantis.com> Workflow+1: Dmitry Ilyin <dilyin@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 22 Sep 2016 21:42:06 +0000 Reviewed-on: https://review.openstack.org/375119 Project: openstack/fuel-noop-fixtures Branch: refs/heads/master
-rw-r--r--lib/noop/manager/library.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/noop/manager/library.rb b/lib/noop/manager/library.rb
index 3c3dafe..d1cadcb 100644
--- a/lib/noop/manager/library.rb
+++ b/lib/noop/manager/library.rb
@@ -78,13 +78,16 @@ module Noop
78 # Read them all to a Hash by their ids. 78 # Read them all to a Hash by their ids.
79 # Find all 'groups' records and resolve their 'tasks' reference 79 # Find all 'groups' records and resolve their 'tasks' reference
80 # by pointing referenced tasks to this group instead. 80 # by pointing referenced tasks to this group instead.
81 # Using the SPEC_NO_GRAPH_METADATA environment variable
82 # disable the task graph processing.
81 # @return [Hash<String => Hash>] 83 # @return [Hash<String => Hash>]
82 def task_graph_metadata 84 def task_graph_metadata
85 return {} if ENV['SPEC_NO_GRAPH_METADATA']
83 return @task_graph_metadata if @task_graph_metadata 86 return @task_graph_metadata if @task_graph_metadata
84 @task_graph_metadata = {} 87 @task_graph_metadata = {}
85 Noop::Config.list_path_modules.each do |path| 88 Noop::Config.list_path_modules.each do |path|
86 next unless path.directory? 89 next unless path.directory?
87 path.find do |task_file| 90 find_files(path) do |task_file|
88 next unless task_file.file? 91 next unless task_file.file?
89 next unless task_file.to_s.end_with? 'tasks.yaml' 92 next unless task_file.to_s.end_with? 'tasks.yaml'
90 begin 93 begin
@@ -96,6 +99,7 @@ module Noop
96 id = task['id'] 99 id = task['id']
97 @task_graph_metadata[id] = task 100 @task_graph_metadata[id] = task
98 end 101 end
102 false
99 end 103 end
100 end 104 end
101 105
@@ -185,12 +189,13 @@ module Noop
185 def spec_run_metadata 189 def spec_run_metadata
186 return @spec_run_metadata if @spec_run_metadata 190 return @spec_run_metadata if @spec_run_metadata
187 @spec_run_metadata = {} 191 @spec_run_metadata = {}
188 Noop::Config.dir_path_task_spec.find do |spec_file| 192 find_files(Noop::Config.dir_path_task_spec) do |spec_file|
189 next unless spec_file.file? 193 next unless spec_file.file?
190 next unless spec_file.to_s.end_with? '_spec.rb' 194 next unless spec_file.to_s.end_with? '_spec.rb'
191 spec_name = spec_file.relative_path_from(Noop::Config.dir_path_task_spec) 195 spec_name = spec_file.relative_path_from(Noop::Config.dir_path_task_spec)
192 spec_data = parse_spec_file spec_file 196 spec_data = parse_spec_file spec_file
193 @spec_run_metadata[spec_name] = spec_data if spec_data.any? 197 @spec_run_metadata[spec_name] = spec_data if spec_data.any?
198 false
194 end 199 end
195 @spec_run_metadata 200 @spec_run_metadata
196 end 201 end