Ejemplo n.º 1
0
def list_nodes(silent=False):
    if not settings.operation_profile:
        settings.operation_profile = 'master_profile'
    salt_master = get_profile(settings.operation_profile)
    data = expose_machines(salt_master)
    if not silent:
        logger.info("Online instances:")
        inst_list = expose_machines(salt_master)
        for i in inst_list:
            logger.info("Instance: %s    IP:    %s    State:    %s    uuid: %s" % (i.name, i.public_ips, i.state, i.uuid))
Ejemplo n.º 2
0
def list_nodes(silent=False):
    if not settings.operation_profile:
        settings.operation_profile = 'master_profile'
    salt_master = get_profile(settings.operation_profile)
    data = expose_machines(salt_master)
    if not silent:
        logger.info("Online instances:")
        inst_list = expose_machines(salt_master)
        for i in inst_list:
            logger.info(
                "Instance: %s    IP:    %s    State:    %s    uuid: %s" %
                (i.name, i.public_ips, i.state, i.uuid))
Ejemplo n.º 3
0
def list_ips(node_name=None):
    if not settings.operation_profile:
        settings.operation_profile = 'master_profile'
    salt_master = get_profile(settings.operation_profile)
    data = expose_machines(salt_master)
    for i in data:
        try:
            print "%s <==> %s" % (i.name, i.public_ips[0])
        except IndexError as e:
            print "%s <==> %s" % (i.name, i.public_ips)
Ejemplo n.º 4
0
def list_ips(node_name=None):
    if not settings.operation_profile:
        settings.operation_profile = 'master_profile'
    salt_master = get_profile(settings.operation_profile)
    data = expose_machines(salt_master)
    for i in data:
        try:
            print "%s <==> %s" % (i.name, i.public_ips[0])
        except IndexError as e:
            print "%s <==> %s" % (i.name, i.public_ips)
Ejemplo n.º 5
0
def terminate(instance_name=None):
    """
    Destroy node and all minion nodes.

    This is dangerious. 
    """

    # $ python -m seed -a terminate -n [name]
    instance_name = instance_name or settings.name
    if instance_name is None:
        raise SeedZeroNameError(
            "You must specify a name to terminate a salt master")

    salt_master = aws.master_profile.copy()
    libcloud_nodes = expose_machines(salt_master)
    for libcloud_node in libcloud_nodes:
        if libcloud_node.name == instance_name:
            terminate_node(libcloud_node)
            return True

    raise SeedMachineDoesNotExistError(instance_name)
Ejemplo n.º 6
0
def terminate(instance_name=None):
    """
    Destroy node and all minion nodes.

    This is dangerious. 
    """
    
    # $ python -m seed -a terminate -n [name]
    instance_name = instance_name or settings.name
    if instance_name is None:
        raise SeedZeroNameError("You must specify a name to terminate a salt master")

    salt_master = aws.master_profile.copy()
    libcloud_nodes = expose_machines(salt_master)
    for libcloud_node in libcloud_nodes:
        if libcloud_node.name == instance_name:
            terminate_node(libcloud_node)
            return True      
    

    raise SeedMachineDoesNotExistError(instance_name)