Exemplo n.º 1
0
def get_fallback_config() -> KtrConf:
    """
    This function provides fallback values for kentauros instance settings and puts them into a
    :py:class:`KtrConf` instance for further processing.

    Returns:
        KtrConf: fallback settings
    """

    result = KtrConf(KtrConfType.FALLBACK, basedir=os.path.abspath("./"))

    if result.validate():
        return result
    else:
        print(LOG_PREFIX1 + "Something went horribly wrong here.", flush=True)
        return None
Exemplo n.º 2
0
def get_cli_config() -> KtrConf:
    """
    This function reads and parses command line settings and switches and puts them into a
    :py:class:`KtrConf` instance for further processing.

    Returns:
        KtrConf: settings parsed from command line settings or switches
    """

    cli_args = CLIArgs()

    # if no settings were set at command line, return None
    if cli_args.get_ktr_basedir() is None:
        return None

    result = KtrConf(KtrConfType.CLI, basedir=os.path.abspath(cli_args.get_ktr_basedir()))

    if result.validate():
        return result
    else:
        print(LOG_PREFIX1 + "Not all necessary values have been set at CLI.", flush=True)
        return None