[PATCH compass-ci 1/3] sched: response ipxe_response value if ipxe_response filed in job yaml

Signed-off-by: Cao Xueliang <caoxl78320@163.com> --- src/scheduler/find_job_boot.cr | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scheduler/find_job_boot.cr b/src/scheduler/find_job_boot.cr index 9e2898e..e8d590b 100644 --- a/src/scheduler/find_job_boot.cr +++ b/src/scheduler/find_job_boot.cr @@ -160,6 +160,8 @@ class Sched end private def get_boot_ipxe(job : Job) + return job["ipxe_response"] if job["ipxe_response"]? + response = "#!ipxe\n\n" _initrds_uri = Array(String).from_json(job.initrds_uri).map { |uri| "initrd #{uri}" } -- 2.23.0

filed => field
private def get_boot_ipxe(job : Job) + return job["ipxe_response"] if job["ipxe_response"]?
What if job["ipxe_response"] exists but is nil/false? 如果你的意思是 "ipxe_response"字段是否存在,那么就把代码写成 字段是否存在。 避免间接和偷懒的if测试。 那容易让人误解,抓不住你原本的目的。 Thanks, Fengguang
response = "#!ipxe\n\n"
_initrds_uri = Array(String).from_json(job.initrds_uri).map { |uri| "initrd #{uri}" } -- 2.23.0

On Thu, Feb 25, 2021 at 11:49:58AM +0800, Wu Fengguang wrote:
filed => field
New patch had fix that.
private def get_boot_ipxe(job : Job) + return job["ipxe_response"] if job["ipxe_response"]?
What if job["ipxe_response"] exists but is nil/false?
如果你的意思是 "ipxe_response"字段是否存在,那么就把代码写成 字段是否存在。 避免间接和偷懒的if测试。 那容易让人误解,抓不住你原本的目的。
Good! Thanks, Xueliang
Thanks, Fengguang
response = "#!ipxe\n\n"
_initrds_uri = Array(String).from_json(job.initrds_uri).map { |uri| "initrd #{uri}" } -- 2.23.0

On Thu, Feb 25, 2021 at 11:49:58AM +0800, Wu Fengguang wrote:
filed => field
private def get_boot_ipxe(job : Job) + return job["ipxe_response"] if job["ipxe_response"]?
What if job["ipxe_response"] exists but is nil/false?
如果你的意思是 "ipxe_response"字段是否存在,那么就把代码写成 字段是否存在。 避免间接和偷懒的if测试。 那容易让人误解,抓不住你原本的目的。
We may need to add has_key for Job class. Thanks, Xueliang
Thanks, Fengguang
response = "#!ipxe\n\n"
_initrds_uri = Array(String).from_json(job.initrds_uri).map { |uri| "initrd #{uri}" } -- 2.23.0
participants (2)
-
Cao Xueliang
-
Wu Fengguang