def get_value()

in elkserver/docker/redelk-base/redelkinstalldata/scripts/modules/helpers.py [0:0]


def get_value(path, source, default_value=None):
    """Gets the value in source based on the provided path, or 'default_value' if not exists (default: None)"""
    split_path = path.split(".")
    if split_path[0] in source:
        if len(split_path) > 1:
            return get_value(".".join(split_path[1:]), source[split_path[0]])
        if split_path[0] == "ip":
            if isinstance(source[split_path[0]], type([])):
                return source[split_path[0]][0]
        return source[split_path[0]]
    return default_value