On Sat, Feb 20, 2021 at 09:02:18AM +0800, Cao Xueliang wrote:
On Fri, Feb 19, 2021 at 09:23:33PM +0800, Li Ping wrote:
[why]: if the hosts_file 2288hv5-2s44p-38g--a6 already in lkp-tests/hosts/ submit borrow-10d.yaml testbox=2288hv5-2s44p-38g--a6 Traceback (most recent call last): 7: from /home/liping/lkp-tests/sbin/submit:136:in `<main>' 6: from /home/liping/lkp-tests/sbin/submit:136:in `each' 5: from /home/liping/lkp-tests/sbin/submit:150:in `block in <main>' 4: from /home/liping/lkp-tests/lib/job.rb:743:in `each_jobs' 3: from /home/liping/lkp-tests/lib/job.rb:447:in `load_defaults' 2: from /home/liping/lkp-tests/lib/job.rb:432:in `load_self_config' 1: from /home/liping/lkp-tests/lib/job.rb:351:in `load_hosts_config' /home/liping/lkp-tests/lib/job.rb:378:in `get_hosts_file': hosts file not exist: 2288hv5-2s44p-38g, maybe need check testbox field (ArgumentError)
[reason]: get_hosts_file use tbox_group to search for hosts_file
lib/job.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb index eacb7ec95..8f8c91b28 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -366,12 +366,17 @@ class Job end
def get_hosts_file
- testbox_file = "#{ENV['CCI_REPOS']}/lab-#{@job['lab']}/hosts/#{@job['testbox']}"
- return testbox_file if File.file?(testbox_file)
- lab_host = "#{ENV['CCI_REPOS']}/lab-#{@job['lab']}/hosts"
- lkp_host = "#{LKP_SRC}/hosts"
We should make clear that what host in lab or in lkp.
lkp host for user installed compass-ci locally lab host for user request scheduler server
but either way, the original code was not checking the host file correctly.
Thanks, Ping
Thanks, Xueliang
tbox_group = @job['tbox_group'].split(/\.|--/)[0]
- tbox_group_file = "#{LKP_SRC}/hosts/#{tbox_group}"
- return tbox_group_file if File.file?(tbox_group_file)
check_files = ["#{lab_host}/#{@job['testbox']}",
"#{lkp_host}/#{@job['testbox']}",
"#{lab_host}/#{tbox_group}",
"#{lkp_host}/#{tbox_group}"]
check_files.each do |file|
return file if File.file?(file)
end
raise ArgumentError, "hosts file not exist: #{tbox_group}, maybe need check testbox field" end
-- 2.23.0