Beispiel #1
0
def status(args):
    """List the status of the instances and ELB."""
    stacks = find_stacks(args.stack_name)

    cfn = boto.connect_cloudformation()

    for stack in stacks:
        fullstack = cfn.describe_stacks(stack.stack_name)[0]
        yield "\nStack %s" % fullstack.stack_name
        yield format_autoscale_instances(fullstack)
Beispiel #2
0
    def test_find_stacks_pattern(self, mock_conn_cfn):
        from awstools.utils import cloudformation

        l_s = mock_conn_cfn.return_value.list_stacks
        l_s.side_effect = [self.teststacks1, self.teststacks2]

        self.result = cloudformation.find_stacks(pattern='ns')

        l_s.assert_has_calls([mock.call(next_token=None),
                              mock.call(next_token='tok')])

        self.check_slist(['ns1', 'ns2'])
Beispiel #3
0
    def test_find_stacks_valid_all(self, mock_conn_cfn):
        from awstools.utils import cloudformation

        l_s = mock_conn_cfn.return_value.list_stacks
        l_s.side_effect = [self.teststacks1, self.teststacks2]

        self.result = cloudformation.find_stacks(findall=True)

        l_s.assert_has_calls([mock.call(next_token=None),
                              mock.call(next_token='tok')])

        self.check_slist(['test1', 'test2', 'test3', 'ns1', 'ns2', 'deleted'])
Beispiel #4
0
def show_cfg(args):
    """List the instance with AutoScale launch config."""
    stacks = find_stacks(args.stack_name)

    cfn = boto.connect_cloudformation()

    for stack in stacks:
        yield "Stack %s" % stack.stack_name

        stack = cfn.describe_stacks(stack.stack_name)[0]

        asg = find_one_resource(stack, RES_TYPE_ASG)
        for instance in asg.instances:
            yield "  {i!r} LC:{i.launch_config_name}".format(i=instance)
Beispiel #5
0
def batch_update(args):
    """Update a batch of stacks sequentially."""
    args.template = None

    stacks = find_stacks(args.stack_name)
    yield format_stacks(stacks)

    confirm_action(arg, default=False)

    for stack in stacks:
        args.stack_name = stack.stack_name
        try:
            update(args)
        except CommandError as error:
            print error
            if not confirm('Continue anyway?', default=True):
                raise
Beispiel #6
0
def ls(args):
    """List stacks."""
    stacks = find_stacks(args.stack_name, findall=args.all)
    yield format_stacks(stacks)
Beispiel #7
0
def activities(args):
    """Display global activity."""
    stacks = find_stacks(None, findall=True)
    stacks = [s for s in stacks if not s.stack_status.endswith('_COMPLETE')]
    yield format_stacks(stacks)
    yield ''