Only first time should full initialize the job. Next time function "initialized?" will return true, just to use job_content, don't need to set default values. But now, "kernel_version" will let "initialized?" return false. Fix this.
Signed-off-by: Wu Zhende wuzhende666@163.com --- src/lib/job.cr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/lib/job.cr b/src/lib/job.cr index 4bef329..512f256 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -63,6 +63,8 @@ class Job set_defaults() end
+ # Each key must exist after the job is initialized + # Otherwise "initialized"? will return false METHOD_KEYS = %w( id os @@ -91,7 +93,6 @@ class Job kernel_append_root kernel_params docker_image - kernel_version linux_vmlinuz_path linux_modules_initrd linux_headers_initrd @@ -312,7 +313,7 @@ class Job
private def set_kernel_version boot_dir = "#{SRV_OS}/#{os_dir}/boot" - suffix = "-#{kernel_version}" if self["kernel_version"]? + suffix = "-#{self["kernel_version"]}" if self["kernel_version"]? self["linux_vmlinuz_path"] = File.real_path("#{boot_dir}/vmlinuz#{suffix}") if "#{os_mount}" == "initramfs" self["linux_modules_initrd"] = File.real_path("#{boot_dir}/modules#{suffix}.cgz")