bin/omf_ec in omf_ec-6.0.2.pre.2 vs bin/omf_ec in omf_ec-6.0.2
- old
+ new
@@ -21,13 +21,13 @@
flag [:u, :uri]
desc "Debug XMPP traffic mode (include XMPP debug logging messages under debug mode)."
switch [:x, :xmpp]
-desc "Root certificate file"
-arg_name "cert", :optional
-flag [:root_cert]
+desc "Directory containing root certificates"
+arg_name "directory", :optional
+flag [:root_cert_dir]
desc "Your certificate"
arg_name "cert", :optional
flag [:cert]
@@ -38,10 +38,11 @@
desc "Log file directory"
arg_name "directory"
default_value "/tmp"
flag [:log_file_dir]
+# the path given here is relative to the user's home directory
config_file(".config/omf_ec.yml")
desc "Execute an experiment script"
arg_name "path_to_script_file [-- --experiment_property value]"
command :exec do |c|
@@ -194,20 +195,18 @@
on_error do |exception|
true
end
pre do |global_options, command, options, args|
+ #opts = OmfCommon.load_yaml(config_file_name) if File.exist?(config_file_name)
+ #opts.delete("commands")
+ #global_options.merge!(opts)
+
unless global_options[:uri]
help_now! "Incomplete options. Need communication URI"
end
-
- # Import private key
- if global_options[:private_key]
- OmfCommon::Key.instance.import(global_options[:private_key])
- end
-
# Check version
if options[:check]
File.open(args[0], 'r') do |f|
f.read.chomp.match(/OMF_VERSIONS\W*=\W*(.*)/)
versions = $1
@@ -245,14 +244,10 @@
end
end
def load_exp(exp_path, global_options = {} , options = {}, properties = {})
begin
- if global_options[:root_cert] && File.exist?(global_options[:root_cert])
- root = OmfCommon::Auth::Certificate.create_from_x509(File.read(global_options[:root_cert]))
- end
-
if global_options[:cert] && File.exist?(global_options[:cert]) &&
global_options[:key] && File.exist?(global_options[:key])
entity = OmfCommon::Auth::Certificate.create_from_x509(File.read(global_options[:cert]),
File.read(global_options[:key]))
@@ -271,19 +266,19 @@
}
}
}
}
- opts[:communication][:auth] = { certs: [ root.to_pem_compact ] } if root
+ opts[:communication][:auth] = {} if entity
OmfCommon.init(:development, opts) do |el|
setup_logging(global_options)
OmfCommon.comm.on_connected do |comm|
info "Connected using #{comm.conn_info}"
info "Start experiment: #{OmfEc.experiment.id}"
- OmfCommon::Auth::CertificateStore.instance.register(root) if root
+ OmfCommon::Auth::CertificateStore.instance.register_default_certs(global_options[:root_cert_dir]) if global_options[:root_cert_dir]
OmfCommon::Auth::CertificateStore.instance.register(entity, OmfCommon.comm.local_address) if entity
begin
include OmfEc::Backward::DefaultEvents
load exp_path