
On Wed, Dec 02, 2020 at 11:20:43AM +0800, Zhang Yu wrote:
+ def self.handle_job_field(job_content, fields) + fields.each do |field| + case field + when "initrds_uri" + values = job_content["initrds_uri"].to_s.split("\n").map(&.strip).reject!(&.empty?) ^ field good!
Thanks, Baijing
+ values = values.map { |value| JSON::Any.new(value) } + job_content["initrds_uri"] = JSON::Any.new(values) + end + end + + return job_content + end + def self.create_job_cpio(job_content : JSON::Any, base_dir : String) job_content = job_content.as_h + + need_to_handle = ["initrds_uri"] + tmp_job_content = handle_job_field(job_content.clone, need_to_handle)
# put job2sh in an array if job_content.has_key?("job2sh") @@ -100,8 +116,8 @@ module Jobfile::Operate # - this will create a <'#! jobs/pixz.yaml':> in the yaml file # - but the orange is <#! jobs/pixz.yaml> in the user job.yaml # tested : no effect to job.sh - File.open(temp_yaml, "w") do |file| - YAML.dump(job_content, file) + File.open(temp_yaml, "a") do |file| + YAML.dump(tmp_job_content, file) end
# generate unbroken job shell content -- 2.23.0