[why] for commit c725e0f022b7: def each_jobs(&block) each_job_init - load_hosts_config job = deepcopy(@job) @job2 = {} load_defaults + load_hosts_config each_job_init each_job(&block) @jobs.each do |hash|
job = deepcopy(@job) this @job has no load hosts config, so it should do it under "@jobs.each do |hash|" for atomic job.
Signed-off-by: Wei Jihui weijihuiall@163.com --- lib/job.rb | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/job.rb b/lib/job.rb index 14946f47..6359254e 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -696,9 +696,11 @@ class Job each_job_init each_job(&block) @jobs.each do |hash| + @load_hosts_done = false @job = deepcopy(job) @job2 = hash load_defaults + load_hosts_config each_job_init each_job(&block) end
On Sat, Oct 17, 2020 at 04:28:08PM +0800, Wei Jihui wrote:
[why] for commit c725e0f022b7: def each_jobs(&block) each_job_init
- load_hosts_config
Why remove that in c725e0f022b7?
I feel the code becomes more and more hacky.
Fundamentally, load_hosts_config only relies on testbox/tbox_group. hosts/* shall only have ground facts and not has any ERB template code. So it could be loaded in the beginning if we can somehow figure out testbox/tbox_group.
Thanks, Fengguang
job = deepcopy(@job) @job2 = {} load_defaults
- load_hosts_config each_job_init each_job(&block) @jobs.each do |hash|
job = deepcopy(@job) this @job has no load hosts config, so it should do it under "@jobs.each do |hash|" for atomic job.
Signed-off-by: Wei Jihui weijihuiall@163.com
lib/job.rb | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/job.rb b/lib/job.rb index 14946f47..6359254e 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -696,9 +696,11 @@ class Job each_job_init each_job(&block) @jobs.each do |hash|
@load_hosts_done = false @job = deepcopy(job) @job2 = hash load_defaults
endload_hosts_config each_job_init each_job(&block)
-- 2.23.0
On Sat, Oct 17, 2020 at 04:28:08PM +0800, Wei Jihui wrote:
[why] for commit c725e0f022b7: def each_jobs(&block) each_job_init
- load_hosts_config job = deepcopy(@job) @job2 = {} load_defaults
- load_hosts_config each_job_init each_job(&block) @jobs.each do |hash|
job = deepcopy(@job) this @job has no load hosts config, so it should do it under "@jobs.each do |hash|" for atomic job.
Signed-off-by: Wei Jihui weijihuiall@163.com
lib/job.rb | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/job.rb b/lib/job.rb index 14946f47..6359254e 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -696,9 +696,11 @@ class Job each_job_init each_job(&block) @jobs.each do |hash|
@load_hosts_done = false
It's fine to call load_hosts_done() in this loop. For example if some job.yaml has this
testbox: - vm-1 - vm-2
Then testbox is unknown outside of the loop.
But why set @load_hosts_done to false to force reload it?
Thanks, Fengguang
@job = deepcopy(job) @job2 = hash load_defaults
endload_hosts_config each_job_init each_job(&block)
-- 2.23.0