Signed-off-by: Li Ping 1477412247@qq.com --- src/lib/job.cr | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/src/lib/job.cr b/src/lib/job.cr index 964c520..12f1e05 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -143,6 +143,7 @@ class Job
check_required_keys() check_account_info() + get_lab_hosts_file() set_defaults() end
@@ -382,6 +383,22 @@ class Job end end
+ private def get_lab_hosts_file + if !@hash["host_file"]? + lab_hosts_file_name = @hash["testbox"] + error_msg = "hosts file not exist: #{lab_hosts_file_name}" + lab_hosts_file = "#{ENV["CCI_REPOS"]}/lab-#{@hash["lab"]}/hosts/#{lab_hosts_file_name}" + if File.file?(lab_hosts_file) + host_hash = YAML.parse(File.read(lab_hosts_file)) + @hash.merge!(JSON.parse(host_hash.to_json).as_h) + else + raise error_msg + end + else + @hash.delete("host_file") + end + end + private def check_account_info error_msg = "Failed to verify the account.\n" error_msg += "Please refer to https://gitee.com/wu_fengguang/compass-ci/blob/master/doc/manual/apply-accou..."