def list_stacks(config, password): stack = CFStack(config, password) print('\nRegion: {}\nEndpoint: {}\n'.format(stack.connection.region.name, stack.connection.region.endpoint)) stacks = stack.list() if len(stacks) == 0: print('No stacks found.') for x in stacks: print("NAME | {}".format(getattr(x, 'stack_name'))) print('-------------+-' + '-' * len(x.stack_id)) for a, b in (('STATUS | {}', 'stack_status'), ('REASON | {}', 'StackStatusReason'), ('LAST UPDATED | {}', 'LastUpdatedTime'), ('DELETED | {}', 'deletion_time'), ('ID | {}', 'stack_id')): try: print(a.format(getattr(x, b))) except AttributeError: print(a.format("None")) if x.stack_status != 'DELETE_COMPLETE': print("STACK EVENTS:") for e in stack.connection.describe_stack_events(x.stack_id): print('\t{}: {}'.format(e.timestamp, e)) print('\n')
def list_stacks(config, password): stack = CFStack(config, password) print('\nRegion: {}\nEndpoint: {}\n'.format( stack.connection.region.name, stack.connection.region.endpoint)) stacks = stack.list() if len(stacks) == 0: print('No stacks found.') for x in stacks: print("NAME | {}".format(getattr(x, 'stack_name'))) print('-------------+-' + '-' * len(x.stack_id)) for a, b in (('STATUS | {}', 'stack_status'), ('REASON | {}', 'StackStatusReason'), ('LAST UPDATED | {}', 'LastUpdatedTime'), ('DELETED | {}', 'deletion_time'), ('ID | {}', 'stack_id')): try: print(a.format(getattr(x, b))) except AttributeError: print(a.format("None")) if x.stack_status != 'DELETE_COMPLETE': print("STACK EVENTS:") for e in stack.connection.describe_stack_events(x.stack_id): print('\t{}: {}'.format(e.timestamp, e)) print('\n')
def test_list(self): stack = CFStack(self.test_config, self.test_password) result = stack.list() self.boto_mock.return_value.list_stacks.assert_called_with()