[PATCH compass-ci] job.cr: add has_key? function in Job class

Signed-off-by: Cao Xueliang <caoxl78320@163.com> --- src/lib/job.cr | 4 ++++ src/scheduler/find_job_boot.cr | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/job.cr b/src/lib/job.cr index c3eeaf4..52965bc 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -332,6 +332,10 @@ class Job @hash.[key]? end + def has_key?(key : String) + @hash.has_key?(key) + end + def []=(key : String, value : String | Nil) if key == "id" || key == "tbox_group" raise "Should not use []= update #{key}, use update_#{key}" diff --git a/src/scheduler/find_job_boot.cr b/src/scheduler/find_job_boot.cr index 88db69e..8dd22a8 100644 --- a/src/scheduler/find_job_boot.cr +++ b/src/scheduler/find_job_boot.cr @@ -160,7 +160,7 @@ class Sched end private def get_boot_ipxe(job : Job) - return job["ipxe_response"] if job["suite"] == "install-iso" && job["ipxe_response"]? + return job["ipxe_response"] if job["suite"] == "install-iso" && job.has_key?("ipxe_response") response = "#!ipxe\n\n" -- 2.23.0
participants (1)
-
Cao Xueliang