How to use the jumbo.utils.session 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
print_missing = []
        print_missing.append('Default:')
        for k, v in missing_comp['default'].items():
            print_missing.append(' - {} {}'.format(v, k))
        print_missing.append('or High Availability:')
        for k, v in missing_comp['ha'].items():
            print_missing.append(' - {} {}'.format(v, k))
        raise ex.CreationError('service', name, 'components', print_missing,
                               'ReqNotMet')

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

    ss.svars['nodes'][m_index]['components'].append(name)
    ss.dump_config(get_services_components_hosts())
github adaltas / jumbo / jumbo / cli / main.py View on Github external
def restart(cluster_name, cluster):
    cluster = cluster_name if cluster_name else cluster

    if not cluster:
        cluster = ss.svars['cluster']

    try:
        vagrant.cmd(['vagrant', 'halt', '--color'], cluster=cluster)
        vagrant.cmd(['vagrant', 'up', '--color'], cluster=cluster)
    except (ex.LoadError, ex.CreationError) as e:
        print_with_color(e.message, 'red')
github adaltas / jumbo / jumbo / utils / checks.py View on Github external
def check_and_call(*args, **kwargs):
        if not kwargs['cluster']:
            raise ex.LoadError('cluster', None, 'NoContext')
        elif not check_cluster(kwargs['cluster']):
            raise ex.LoadError('cluster', kwargs['cluster'], 'NotExist')
        elif kwargs['cluster'] != ss.svars['cluster']:
            if ss.svars['cluster']:
                raise ex.LoadError('cluster', ss.svars['cluster'], 'MustExit')

        return func(*args, **kwargs)
    return check_and_call
github adaltas / jumbo / jumbo / core / nodes.py View on Github external
def check_ip(ip, *, cluster):
    """
    Check if a node with a specified ip is used in a specific cluster.

    :param cluster: Cluster name
    :type cluster: str
    :param ip: IP address to be tested
    :type name: str
    :raises ex.LoadError: If the cluster couldn't be loaded
    :return: True if the ip is used
    :rtype: bool
    """
    for m in ss.svars['nodes']:
        if m['ip'] == ip:
            return m['name']

    return False