Пример #1
0
def set_config(cfg: dict):
    """
    Set/update configuration

    Args:
        cfg: a dict containing ``namespace.key``:``value``

    Returns:
        Status
    """
    client_cfg = utils.get_context()['config']
    for set_key in cfg:
        ns, key = _get_cfg(set_key, False)
        default_ns = ns.lower() in config.ConfigNode.default_namespaces
        if default_ns:
            t = config.ConfigNode.get_type(ns, key)
            if not isinstance(cfg[set_key], t):
                raise exceptions.APIError(
                    utils.this_function(),
                    "Setting '{}' expected '{}' but got '{}'".format(
                        set_key, t, type(cfg[set_key])))
            if config.ConfigNode.get_isolation_level(
                    ns, key) == config.ConfigIsolation.client:
                client_cfg.setdefault(config.config.format_namespace(ns),
                                      {})[key.lower()] = cfg[set_key]
                continue

        with config.config.namespace(ns):
            config.config.update(key, cfg[set_key], create=not default_ns)

    return message.Message("updated")
Пример #2
0
def list_plugins(ctx=None):
    """
    Get a list of available plugin information

    Args:
        an error message object
    """
    return message.Message("works")
Пример #3
0
def save_config():
    """
    Save config to disk

    Returns:
        Status
    """
    config.config.save()
    return message.Message("saved")
Пример #4
0
def uninstall_plugin(plugin_id: str, ctx=None):
    """
    Uninstall a plugin

    Args:
        plugin_id: UUID of plugin

    Returns:
        an error message object
    """
    return message.Message("works")
Пример #5
0
def get_command_progress(command_ids: list):
    """
    Get progress of command in percent

    Args:
        command_ids: list of command ids

    Returns:
        ```
        { command_id : progress }
        ```
    """
    return message.Message("works")
Пример #6
0
def get_plugin(plugin_id: str):
    """
    Get plugin information

    Args:
        plugin_id: get information for a specific plugin

    Returns:
        ```
        { plugin_id: }
        ```
    """
    return message.Message("works")