[why] 1. load job from result's job yaml has key which is start with "#! ", like '#! hosts/vm-2p16g': this key should be deleted. 2. load job from a yaml maybe has symbol key, like # key ---> :'# key': nil but symbol key does not has start_with function.
Signed-off-by: Wei Jihui weijihuiall@163.com --- lib/job.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/job.rb b/lib/job.rb index 7553312e..35e0ceee 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -254,7 +254,6 @@ class Job @overrides.merge!(hash['override']){ |_key, a, _b| a} hash.delete('override') end - hash.delete_if { |key, _| key.start_with?('#!') } hash.merge!(@overrides) @jobs.concat(multi_args(hash)) # return [hash] or [h1,h2] end @@ -290,6 +289,12 @@ class Job jobs_array = [] hash.each { |key, value| next unless key =~ /^\w.*|.*\w$/ + next unless key.is_a?(String) + + if key.start_with?('#! ') + hash.delete(key) + next + end
key_array = key.split('|').map(&:strip) [value].flatten.each do |v|