blockade/cli.py
def cmd_partition(opts):
    """Partition the network between containers

    Replaces any existing partitions outright. Any containers NOT specified
    in arguments will be globbed into a single implicit partition. For
    example if you have three containers: c1, c2, and c3 and you run:

        blockade partition c1

    The result will be a partition with just c1 and another partition with
    c2 and c3.

    Alternatively, --random may be specified, and zero or more random
    partitions will be generated by blockade.
    """
    config = load_config(opts.config)
    b = get_blockade(config, opts)

    if opts.random:
        if opts.partitions:
            raise BlockadeError("Either specify individual partitions "
                                "or --random, but not both")
        b.random_partition()

    else:
        partitions = []
        for partition in opts.partitions:
            names = []
            for name in partition.split(","):
                name = name.strip()
                if name:
                    names.append(name)
            partitions.append(names)
        if not partitions:
            raise BlockadeError("Either specify individual partitions "
                                "or random")
        b.partition(partitions)
def cmd_partition(opts):
    """Partition the network between containers

    Replaces any existing partitions outright. Any containers NOT specified
    in arguments will be globbed into a single implicit partition. For
    example if you have three containers: c1, c2, and c3 and you run:

        blockade partition c1

    The result will be a partition with just c1 and another partition with
    c2 and c3.

    Alternatively, --random may be specified, and zero or more random
    partitions will be generated by blockade.
    """
    config = load_config(opts.config)
    b = get_blockade(config, opts)

    if opts.random:
        if opts.partitions:
            raise BlockadeError("Either specify individual partitions "
                                "or --random, but not both")
        b.random_partition()

    else:
        partitions = []
        for partition in opts.partitions:
            names = []
            for name in partition.split(","):
                name = name.strip()
                if name:
                    names.append(name)
            partitions.append(names)
        if not partitions:
            raise BlockadeError("Either specify individual partitions "
                                "or random")
        b.partition(partitions)
Partition the network between containers

    Replaces any existing partitions outright. Any containers NOT specified
    in arguments will be globbed into a single implicit partition. For
    example if you have three containers: c1, c2, and c3 and you run:

        blockade partition c1

    The result will be a partition with just c1 and another partition with
    c2 and c3.

    Alternatively, --random may be specified, and zero or more random
    partitions will be generated by blockade.