On Fri, Nov 13, 2020 at 11:35:22AM +0800, Liu Shaofei wrote:
On Fri, Nov 13, 2020 at 11:18:59AM +0800, Bai Jing wrote:
[original style] os: openeuler os_verison: 20.03 os_arch: aarch64
os: centos os_version: 8.7 os_arch: aarch64
add blank line.
[now style] os os_version os_arch: - openeuler 20.03 aarch64 - centos 20 aarch64
add blank line. Thanks, Liushaofei
Ok, i will change it.
Thanks, Baijing
[point] Currently, only one key of this style(xx xxx xx) can be contained in YAML files.
Signed-off-by: Bai Jing 799286817@qq.com
lib/job.rb | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb index 01719c2e..f8608e94 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -250,7 +250,7 @@ class Job hash.delete('override') end hash.merge!(@overrides)
@jobs << hash
rescue StandardError => e log_error "#{jobfile}: " + e.message@jobs.concat(multi_args(hash)) # return [hash] or [h1,h2] end
@@ -280,6 +280,30 @@ class Job @jobfile = jobfile end
- def multi_args(hash)
- jobs_array = []
- hash.each { |key, value|
next unless key =~ /^\w.*\s+.*\w$/
next unless value.class == Array
key_array = key.split
value.each do |v|
v_array = v.split
next unless key_array.size == v_array.size
hash_job = hash.clone
key_array.size.times do |i|
hash_job[key_array[i]] = v_array[i]
end
hash_job.delete(key)
jobs_array << hash_job
end
- }
- jobs_array = [hash] if jobs_array.empty?
- return jobs_array
- end
- def delete_keys_from_spec(spec_file) return unless File.exist? spec_file
@@ -703,7 +727,8 @@ class Job @jobs.each do |hash| @load_hosts_done = false @job = deepcopy(job)
@job2 = hash
@job.merge!(hash)
@job2 = {} load_defaults load_hosts_config each_job_init
-- 2.23.0