Signed-off-by: Li Ping <15396232681(a)163.com>
---
lib/job.rb | 15 ++++++---------
lib/job2sh.rb | 1 +
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb
index 5632ad88..e45ae682 100755
--- a/lib/job.rb
+++ b/lib/job.rb
@@ -334,18 +334,15 @@ class Job
end
def get_hosts_file
+ lab_hosts_file = get_lab_hosts_file
+ hosts_file = lab_hosts_file
+ return hosts_file if hosts_file
+
hosts_file_name = @job['tbox_group'].split('--')[0]
hosts_file = "#{LKP_SRC}/hosts/#{hosts_file_name}"
+ return hosts_file if File.file?(hosts_file)
- lab_hosts_file = get_lab_hosts_file
- if lab_hosts_file
- hosts_file = lab_hosts_file
- elsif File.file?(hosts_file)
- hosts_file
- else
- puts("hosts_file not exist: #{hosts_file}, maybe need check testbox field")
- nil
- end
+ puts("hosts_file not exist: #{hosts_file}, maybe need check testbox field")
end
def include_files
diff --git a/lib/job2sh.rb b/lib/job2sh.rb
index 9c95ff4b..7e6a5d7c 100755
--- a/lib/job2sh.rb
+++ b/lib/job2sh.rb
@@ -350,6 +350,7 @@ class Job2sh < Job
out_line
out_line "\texport define_files='#{define_files.keys.join ' '}'"
define_files.each do |file, val|
+ out_line "\tmkdir -p $LKP_SRC/$(dirname #{file})"
out_line "\tcat > $LKP_SRC/#{file} <<'EOF'"
out_line val
out_line "EOF"
--
2.23.0