lib/boot.rb in forj-1.0.11 vs lib/boot.rb in forj-1.0.12
- old
+ new
@@ -139,10 +139,11 @@
:bp_flavor => :bp_flavor,
:maestro_repo => :maestro_repo,
:branch => :branch,
:test_box => :test_box,
:tb_path => :test_box_path,
+ :ca_root_cert => :ca_root_cert,
:extra_metadata => :extra_metadata }
load_options(options, options_map) { |k, v| complete_boot_options(k, v) }
validate_keypath(options)
@@ -169,10 +170,12 @@
case key
when :test_box
value = tb_repo_detect(value)
when :tb_path
value = tb_bin_detect(value)
+ when :ca_root_cert
+ value = ca_root_file_detect(value)
end
value
end
# Function to check the repository path passed.
@@ -242,8 +245,24 @@
def self.tb_check_bin(tb_path)
script = 'test-box.sh'
script = File.expand_path(File.join(tb_path, script))
return script if File.executable?(script)
nil
+ end
+
+ def self.ca_root_file_detect(param)
+ res_found = param.match(/^(.*)#(.*)$/)
+
+ if res_found
+ cert_file = res_found[1]
+ else
+ cert_file = param
+ end
+
+ unless File.readable?(cert_file)
+ PrcLib.error("Unable to read the Root Certificate file '%s'", cert_file)
+ return nil
+ end
+ param
end
end
end