Ejemplo n.º 1
0
def get_config():
    """
    :returns: Configuration object
    :rtype: Toml
    """

    # avoid circular import
    from dcos import config

    return config.load_from_path(os.environ[constants.DCOS_CONFIG_ENV])
Ejemplo n.º 2
0
def get_config(mutable=False):
    """ Returns the DCOS configuration object

    :param mutable: True if the returned Toml object should be mutable
    :type mutable: boolean
    :returns: Configuration object
    :rtype: Toml | MutableToml
    """

    # avoid circular import
    from dcos import config

    path = get_config_path()

    return config.load_from_path(path, mutable)
Ejemplo n.º 3
0
def get_config(mutable=False):
    """ Returns the DCOS configuration object

    :param mutable: True if the returned Toml object should be mutable
    :type mutable: boolean
    :returns: Configuration object
    :rtype: Toml | MutableToml
    """

    # avoid circular import
    from dcos import config

    path = get_config_path()

    return config.load_from_path(path, mutable)
Ejemplo n.º 4
0
def get_config(mutable=False):
    """Returns the DCOS configuration object and creates config file is none
    found and `DCOS_CONFIG` set to default value

    :param mutable: True if the returned Toml object should be mutable
    :type mutable: boolean
    :returns: Configuration object
    :rtype: Toml | MutableToml
    """

    # avoid circular import
    from dcos import config

    path = get_config_path()
    default = get_default_config_path()

    if path == default:
        ensure_dir_exists(os.path.dirname(default))
    return config.load_from_path(path, mutable)
Ejemplo n.º 5
0
def get_config(mutable=False):
    """Returns the DCOS configuration object and creates config file is none
    found and `DCOS_CONFIG` set to default value

    :param mutable: True if the returned Toml object should be mutable
    :type mutable: boolean
    :returns: Configuration object
    :rtype: Toml | MutableToml
    """

    # avoid circular import
    from dcos import config

    path = get_config_path()
    default = get_default_config_path()

    if path == default:
        ensure_dir_exists(os.path.dirname(default))
    return config.load_from_path(path, mutable)
Ejemplo n.º 6
0
 def get_config(self, mutable=False):
     return config.load_from_path(self.get_config_path(), mutable)