def destroy_infra(databaseinfra, task=None):

    try:
        database = databaseinfra.databases.get()
        LOG.debug('Database found! {}'.format(database))
    except __HOLE__:
        LOG.info("Database not found...")

    if not databaseinfra.plan.provider == databaseinfra.plan.CLOUDSTACK:
        LOG.error('Databaseinfra is not cloudstack infra')
        return True

    instances = []
    hosts = []

    for instance in databaseinfra.instances.all():
        instances.append(instance)
        hosts.append(instance.hostname)

    workflow_dict = build_dict(plan=databaseinfra.plan,
                               environment=databaseinfra.environment,
                               steps=get_deploy_settings(
                                   databaseinfra.plan.engine_type.name),
                               qt=get_vm_qt(plan=databaseinfra.plan),
                               dbtype=str(databaseinfra.plan.engine_type),
                               hosts=hosts,
                               instances=instances,
                               databaseinfra=databaseinfra,
                               database=database
                               )

    if stop_workflow(workflow_dict=workflow_dict, task=task):
        return workflow_dict
    else:
        return False
dataset/ETHPy150Open globocom/database-as-a-service/dbaas/util/providers.py/destroy_infra