def fetch_image_into_cache(self, image_id): ctx = registry.get_client_context(self.conf, is_admin=True, show_deleted=True) try: image_meta = registry.get_image_metadata(ctx, image_id) if image_meta["status"] != "active": logger.warn(_("Image '%s' is not active. Not caching."), image_id) return False except exception.NotFound: logger.warn(_("No metadata found for image '%s'"), image_id) return False image_data, image_size = get_from_backend(image_meta["location"]) logger.debug(_("Caching image '%s'"), image_id) self.cache.cache_image_iter(image_id, image_data) return True
def queue_image(self, image_id): ctx = \ registry.get_client_context(conf, is_admin=True, show_deleted=True) try: image_meta = registry.get_image_metadata(ctx, image_id) if image_meta['status'] != 'active': logger.warn(_("Image '%s' is not active. Not queueing."), image_id) return False except exception.NotFound: logger.warn(_("No metadata found for image '%s'"), image_id) return False logger.debug(_("Queueing image '%s'"), image_id) self.cache.queue_image(image_id) return True
def fetch_image_into_cache(self, image_id): ctx = registry.get_client_context(self.conf, is_admin=True, show_deleted=True) try: image_meta = registry.get_image_metadata(ctx, image_id) if image_meta['status'] != 'active': logger.warn(_("Image '%s' is not active. Not caching."), image_id) return False except exception.NotFound: logger.warn(_("No metadata found for image '%s'"), image_id) return False image_data, image_size = get_from_backend(image_meta['location']) logger.debug(_("Caching image '%s'"), image_id) self.cache.cache_image_iter(image_id, image_data) return True