How to use the jumbo.utils.session.dump_config function in jumbo

To help you get started, we’ve selected a few jumbo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adaltas / jumbo / jumbo / core / services.py View on Github external
raise ex.LoadError('node', node, 'NotExist')

    service = check_component(component)
    if not service:
        raise ex.LoadError('component', component, 'NotExist')

    for i, m in enumerate(ss.svars['nodes']):
        if m['name'] == node:
            m_index = i

    if component not in ss.svars['nodes'][m_index]['components']:
        raise ex.CreationError('node', node, 'component', component,
                               'NotInstalled')

    ss.svars['nodes'][m_index]['components'].remove(component)
    ss.dump_config(get_services_components_hosts())
github adaltas / jumbo / jumbo / core / clusters.py View on Github external
def repair_cluster(domain, *, cluster):
    """Recreate the cluster 'jumbo_config' file if it doesn't exist.

    :param name: Cluster name
    :type name: str
    :param domain: Cluster domaine name
    :type domain: str
    :return: True if the 'jumbo_config' has been recreated
    """
    if not check_config(cluster):
        ss.clear()
        ss.svars['cluster'] = cluster
        ss.svars['domain'] = domain if domain else '%s.local' % cluster
        ss.dump_config()
        return True

    return False
github adaltas / jumbo / jumbo / core / nodes.py View on Github external
changed = []

    for i, m in enumerate(ss.svars['nodes']):
        if m['name'] == name:
            if ip:
                changed.append(["IP", ss.svars['nodes'][i]['ip'], ip])
                ss.svars['nodes'][i]['ip'] = ip
            if ram:
                changed.append(["RAM", ss.svars['nodes'][i]['ram'], ram])
                ss.svars['nodes'][i]['ram'] = ram
            if cpus:
                changed.append(["CPUs", ss.svars['nodes'][i]['cpus'], cpus])
                ss.svars['nodes'][i]['cpus'] = cpus

    ss.dump_config()

    return changed
github adaltas / jumbo / jumbo / core / nodes.py View on Github external
raise ex.CreationError('node', name, 'type', 'ldap',
                                   'LDAPNotCompatible')

    m = {
        'name': name,
        'ip': ip,
        'ram': ram,
        'types': types,
        'cpus': cpus,
        'components': [],
        'groups': []
    }

    ss.load_config(cluster=cluster)
    ss.add_node(m)
    ss.dump_config()
github adaltas / jumbo / jumbo / core / nodes.py View on Github external
:param name: Machine name
    :type name: str
    :raises ex.LoadError: If the node or the cluster couldn't be loaded
    :return: True if the session context has changed
    :rtype: bool
    """
    ss.load_config(cluster)

    if not check_node(cluster=cluster, node=node):
        raise ex.LoadError('node', node, 'NotExist')

    for i, m in enumerate(ss.svars['nodes']):
        if m['name'] == node:
            del(ss.svars['nodes'][i])

    ss.dump_config()