When submitting a job, an exception is thrown when deps/pkg does not exist on the server.
Signed-off-by: Cao Xueliang caoxl78320@163.com --- src/lib/job.cr | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/lib/job.cr b/src/lib/job.cr index 32aa662..ef515b8 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -389,11 +389,21 @@ class Job program_params.keys.each do |program| deps_dest_file = "#{SRV_INITRD}/deps/#{mount_type}/#{os_dir}/#{program}.cgz" pkg_dest_file = "#{SRV_INITRD}/pkg/#{mount_type}/#{os_dir}/#{program}.cgz" - if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") && File.exists?(deps_dest_file) - initrd_deps_arr << "#{initrd_http_prefix}" + JobHelper.service_path(deps_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") + if File.exists?(deps_dest_file) + initrd_deps_arr << "#{initrd_http_prefix}" + JobHelper.service_path(deps_dest_file) + else + raise "#{deps_dest_file} does not exist on the server." + end end - if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") && File.exists?(pkg_dest_file) - initrd_pkg_arr << "#{initrd_http_prefix}" + JobHelper.service_path(pkg_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") + if File.exists?(pkg_dest_file) + initrd_pkg_arr << "#{initrd_http_prefix}" + JobHelper.service_path(pkg_dest_file) + else + raise "#{pkg_dest_file} does not exist on the server." + end end end end