[why]
if you add job field like this :
os: openeuler
os_version: 20.03
os_arch: aarch64
nr_threads:
- 1
- 2
then the @jobs=[hash],
hash={"nr_threads"=>[1,2],"os"=>"openeuler","os_arch"=>"aarch64","os_version"=>"20.03"}
if you add job field like this:
os os_version os_arch:
- openeuler 20.03 aarch64
- openeuler 20 aarch64
nr_threads:
- 1
- 2
then the @jobs=[h1, h2],
h1={"nr_threads"=>[1, 2],"os"=>"openeuler",
"os_version"=>"20.03","os_arch"=>"aarch64"}
h2={"nr_threads"=>[1, 2],"os"=>"openeuler",
"os_version"=>"20","os_arch"=>"aarch64"}
h2 will split to 2 jobs by function "each_job"
Should:
job1={"nr_threads"=>1}
job2={"nr_threads"=>2}
But if "@job2=hash",will get:
job1={"nr_threads"=>[1, 2]}
job2={"nr_threads"=>[1, 2]}
Because "@job2=hash" will merge the h2 to @job after "each_job".
We need to merge the h2 to @job before "each_job".
So do the merge advance and set @job2={}
Signed-off-by: Bai Jing <799286817(a)qq.com>
---
lib/job.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/job.rb b/lib/job.rb
index c8893433..9272392e 100755
--- a/lib/job.rb
+++ b/lib/job.rb
@@ -730,7 +730,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