Exemple #1
0
def delete_all_stacks():
    stacks = TempestClients.heat().stacks.list()
    for stack in stacks:
        try:
            TempestClients.heat().stacks.delete(stack.to_dict()['id'])
        except Exception:
            pass

    wait_for_status(30, _check_num_stacks, num_stacks=0)
    time.sleep(4)
Exemple #2
0
def create_stacks(num_stacks, nested, template_file):
    tpl_files, template = template_utils.process_template_path(
        template_file,
        object_request=http.authenticated_fetcher(TempestClients.heat()))

    for i in range(num_stacks):
        stack_name = 'stack_%s' % i + ('_nested' if nested else '')
        TempestClients.heat().stacks.create(stack_name=stack_name,
                                            template=template,
                                            files=tpl_files,
                                            parameters={})
        wait_for_status(45,
                        _check_num_stacks,
                        num_stacks=num_stacks,
                        state='CREATE_COMPLETE')
        time.sleep(2)
Exemple #3
0
def _check_num_stacks(num_stacks, state=''):
    stacks_list = \
        [stack.to_dict() for stack in TempestClients.heat().stacks.list()
         if 'FAILED' not in stack.to_dict()['stack_status']]
    if len(stacks_list) != num_stacks:
        return False

    return all(stack['stack_status'].upper() == state.upper()
               for stack in stacks_list)