On Thu, Dec 24, 2020 at 10:28:34AM +0800, Wei Jihui wrote:
[why]
- 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
为什么job.yaml中会有 :key 这种形式呢? 都写成字符串不是更好吗? 没看见过类似的key.
Thanks, RenWen
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|
-- 2.23.0