def cleanup(): openstack_client = init() flavor_name = cfg.CONF.flavor_name image_name = cfg.CONF.image_name image = glance.get_image(openstack_client.glance, image_name) if image: openstack_client.glance.images.delete(image) flavor = nova.get_flavor(openstack_client.nova, flavor_name) if flavor: openstack_client.nova.flavors.delete(flavor)
def cleanup(): openstack_client = init(config.OPENSTACK_OPTS) flavor_name = cfg.CONF.flavor_name image_name = cfg.CONF.image_name image = glance.get_image(openstack_client.glance, image_name) if image: openstack_client.glance.images.delete(image) flavor = nova.get_flavor(openstack_client.nova, flavor_name) if flavor: openstack_client.nova.flavors.delete(flavor)
def cleanup(): openstack_client = init() flavor_name = cfg.CONF.flavor_name image_name = cfg.CONF.image_name if not cfg.CONF.cleanup: LOG.info('Skip cleanup') return image = glance.get_image(openstack_client.glance, image_name) if image: openstack_client.glance.images.delete(image.id) flavor = nova.get_flavor(openstack_client.nova, flavor_name) if flavor: openstack_client.nova.flavors.delete(flavor.id)