

def clean_installers():
    os_installers = [os_installer for os_installer in flags.OPTIONS.os_installers.split(',') if os_installer]
    package_installers = [package_installer for package_installer in flags.OPTIONS.package_installers.split(',') if package_installer]
    user = user_api.get_user_object(setting.COMPASS_ADMIN_EMAIL)
    adapters = adapter_api.list_adapters(user=user)
    filtered_os_installers = {
        
    }
    filtered_package_installers = {
        
    }
    for adapter in adapters:
        logging.info('got adapter: %s', adapter)
        if ('os_installer' in adapter):
            os_installer = adapter['os_installer']
            os_installer_name = os_installer['alias']
            if ((not os_installers) or (os_installer_name in os_installers)):
                os_installer_name[os_installer_name] = os_installer
            else:
                logging.info('ignore os installer %s', os_installer_name)
        else:
            logging.info('cannot find os installer in adapter %s', adapter['name'])
        if ('package_installer' in adapter):
            package_installer = adapter['package_installer']
            package_installer_name = package_installer['alias']
            if ((not package_installers) or (package_installer_name in package_installers)):
                filtered_package_installers[package_installer_name] = package_installer
            else:
                logging.info('ignore package installer %s', package_installer_name)
        else:
            logging.info('cannot find package installer in adapter %s', adapter['name'])
    logging.info('clean os installers: %s', filtered_os_installers.keys())
    logging.info('clean package installers: %s', filtered_package_installers.keys())
    if flags.OPTIONS.async:
        for (os_installer_name, os_installer) in filtered_os_installers.items():
            celery.send_task('compass.tasks.clean_os_installer', (os_installer['name'], os_installer['settings']))
        for (package_installer_name, package_installer) in filtered_package_installers.items():
            celery.send_task('compass.tasks.clean_package_installer', (package_installer['name'], package_installer['settings']))
    else:
        for (os_installer_name, os_installer) in filtered_os_installers.items():
            try:
                clean.clean_os_installer(os_installer['name'], os_installer['settings'])
            except Exception as error:
                logging.error('failed to clean os installer %s', os_installer_name)
                logging.exception(error)
        for (package_installer_name, package_installer) in filtered_package_installers.items():
            try:
                clean.clean_package_installer(package_installer['name'], package_installer['settings'])
            except Exception as error:
                logging.error('failed to clean package installer %s', package_installer_name)
                logging.exception(error)

dataset/ETHPy150Open openstack/compass-core/bin/clean_installers.py clean_installers/VarMisuse@142/233 `filtered_os_installers`->`os_installer_name`