def run_cmd_add_config()

in helix-core/src/main/scripts/integration-test/script/dds_driver.py [0:0]


def run_cmd_add_config(cmd):
    if options.operation in ["start","clean_log","default"]:
      if options.enable_direct_java_call:
        pass_down_options=direct_java_call_option_mapping.keys()
        pass_down_options.extend(direct_java_call_jvm_args.keys())
        #pass_down_options.extend(direct_java_call_jvm_args_ordered)
      else:
        pass_down_options=ant_call_option_mapping.keys()
      #option_mapping = options.enable_direct_java_call and direct_java_call_option_mapping or ant_call_option_mapping
      #if options.enable_direct_java_call: pass_down_options.append("jvm_args")
      if options.config:
        if not remote_run:
          cmd = run_cmd_add_option(cmd, "config", options.config, check_exist=True)      # check exist will figure out
        else:
          cmd = run_cmd_add_option(cmd, "config", os.path.join(get_remote_view_root(), options.config), check_exist=False)
      run_cmd_view_root = remote_run and get_remote_view_root() or get_view_root()
      #cmd = run_cmd_add_option(cmd, "dump_file", options.dump_file and os.path.join(run_cmd_view_root, options.dump_file) or None)
      #cmd = run_cmd_add_option(cmd, "value_file", options.value_file and os.path.join(run_cmd_view_root, options.value_file) or None)
      #cmd = run_cmd_add_option(cmd, "log4j_file", options.log4j_file and os.path.join(run_cmd_view_root, options.log4j_file) or None)
      #cmd = run_cmd_add_option(cmd, "jvm_direct_memory_size")
      #cmd = run_cmd_add_option(cmd, "jvm_max_heap_size")
      #cmd = run_cmd_add_option(cmd, "jvm_gc_log")
      #cmd = run_cmd_add_option(cmd, "jvm_args")
      #cmd = run_cmd_add_option(cmd, "db_config_file")
      #cmd = run_cmd_add_option(cmd, "cmdline_props")
#      cmd = run_cmd_add_option(cmd, "filter_conf_file")

      if options.checkpoint_dir:
         if options.checkpoint_dir == "auto":
           checkpoint_dir = os.path.join(get_work_dir(), "databus2_checkpoint_%s_%s" % time.strftime('%y%m%d_%H%M%S'), os.getpid())
         else:
           checkpoint_dir = options.checkpoint_dir
         checkpoint_dir = os.path.join(run_cmd_view_root(), checkpoint_dir)
         cmd = run_cmd_add_option(cmd, "checkpoint_dir", checkpoint_dir)
         # clear up the directory
         if not options.checkpoint_keep and os.path.exists(checkpoint_dir): distutils.dir_util.remove_tree(checkpoint_dir)

      # options can be changed during remote run
      if remote_run:
        remote_component_properties = remote_run_config[remote_component]
        if not options.relay_host and "relay_host" in remote_component_properties: options.relay_host = remote_component_properties["relay_host"]
        if not options.relay_port and "relay_port" in remote_component_properties: options.relay_port = remote_component_properties["relay_port"]
        if not options.bootstrap_host and "bootstrap_host" in remote_component_properties: options.bootstrap_host = remote_component_properties["bootstrap_host"]
        if not options.bootstrap_port and "bootstrap_port" in remote_component_properties: options.bootstrap_port = remote_component_properties["bootstrap_port"]
      #cmd = run_cmd_add_option(cmd, "relay_host")
      #cmd = run_cmd_add_option(cmd, "relay_port")
      #cmd = run_cmd_add_option(cmd, "bootstrap_host")
      #cmd = run_cmd_add_option(cmd, "bootstrap_port")
      #cmd = run_cmd_add_option(cmd, "consumer_event_pattern")
      if re.search("_consumer",options.component):
        # next available port
        if options.http_port: http_port = options.http_port
        else: http_port = next_available_port(consumer_host, consumer_http_start_port)
        #cmd = run_cmd_add_option(cmd, "http_port", http_port)
        #cmd = run_cmd_add_option(cmd, "jmx_service_port", next_available_port(consumer_host, consumer_jmx_service_start_port))
      # this will take care of the passdown, no need for run_cmd_add_directly
      for option in [x for x in pass_down_options if x not in run_cmd_added_options]:
        cmd = run_cmd_add_option(cmd, option)


    if options.component=="espresso-relay": cmd+= " -d " # temp hack. TODO: remove

    if options.enable_direct_java_call:
      #cmd = re.sub("java -classpath","java -d64 -ea %s -classpath" % " ".join([x[0]+x[1] for x in [direct_java_call_jvm_args[y] for y in direct_java_call_jvm_args_ordered] if x[1]]) ,cmd) # d64 here
      cmd = re.sub("java -classpath","java -d64 -ea %s -classpath" % " ".join([x[0]+x[1] for x in direct_java_call_jvm_args.values() if x[1]]) ,cmd) # d64 here
    dbg_print("cmd = %s" % cmd)
    return cmd