Ejemplo n.º 1
0
def create_tracker_config(config_file: str, stmgr_override: dict) -> dict:
    # try to parse the config file if we find one
    config = utils.parse_config_file(config_file)
    if config is None:
        Log.debug(f"Config file does not exists: {config_file}")
        config = {STATEMGRS_KEY: [{}]}

    # update non-null options
    config[STATEMGRS_KEY][0].update(
        (k, v) for k, v in stmgr_override.items() if v is not None)
    return config
Ejemplo n.º 2
0
def create_tracker_config(namespace):
    # try to parse the config file if we find one
    config_file = namespace["config_file"]
    config = utils.parse_config_file(config_file)
    if config is None:
        Log.debug("Config file does not exists: %s" % config_file)
        config = {STATEMGRS_KEY: [{}]}

    # update the config if we have any flags
    config_flags = ["type", "name", "rootpath", "tunnelhost", "hostport"]
    config_to_update = config[STATEMGRS_KEY][0]
    for flag in config_flags:
        value = namespace.get(flag, None)
        if value is not None:
            config_to_update[flag] = value

    return config
Ejemplo n.º 3
0
def create_tracker_config(namespace):
  # try to parse the config file if we find one
  config_file = namespace["config_file"]
  config = utils.parse_config_file(config_file)
  if config is None:
    Log.debug("Config file does not exists: %s" % config_file)
    config = {STATEMGRS_KEY:[{}]}

  # update the config if we have any flags
  config_flags = ["type", "name", "rootpath", "tunnelhost", "hostport"]
  config_to_update = config[STATEMGRS_KEY][0]
  for flag in config_flags:
    value = namespace.get(flag, None)
    if value is not None:
      config_to_update[flag] = value

  return config