[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)
[how] add check host file at: 1. lab repo + tbox_group 2. lkp_src repo + testbox --- lib/job.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb index 7fc7cb5b6..8ac5d7a98 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -366,14 +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_repo = "#{ENV['CCI_REPOS']}/lab-#{@job['lab']}" 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)
- raise ArgumentError, "hosts file not exist: #{tbox_group}, maybe need check testbox field" + ["#{lab_repo}/hosts/#{@job['testbox']}", + "#{LKP_SRC}/hosts/#{@job['testbox']}", + "#{lab_repo}/hosts/#{tbox_group}", + "#{LKP_SRC}/hosts/#{tbox_group}"].each do |file| + return file if File.file?(file) + end + + raise ArgumentError, "hosts file not exist: #{tbox_group}, maybe need check testbox field" end
def include_files