def create_image(image_repo, image_factory, image_properties, task_id): _base_properties = [] for k, v in v2_api.get_base_properties().items(): _base_properties.append(k) properties = {} # NOTE: get the base properties for key in _base_properties: try: properties[key] = image_properties.pop(key) except KeyError: msg = ("Task ID %(task_id)s: Ignoring property %(k)s for setting " "base properties while creating " "Image.") % { 'task_id': task_id, 'k': key } LOG.debug(msg) # NOTE: get the rest of the properties and pass them as # extra_properties for Image to be created with them. properties['extra_properties'] = image_properties script_utils.set_base_image_properties(properties=properties) image = image_factory.new_image(**properties) image_repo.add(image) return image
def create_image(image_repo, image_factory, image_properties, task_id): properties = {} # NOTE: get the base properties for key in v2_api.get_base_properties(): try: properties[key] = image_properties.pop(key) except KeyError: LOG.debug("Task ID %(task_id)s: Ignoring property %(k)s for " "setting base properties while creating " "Image.", {'task_id': task_id, 'k': key}) # NOTE: get the rest of the properties and pass them as # extra_properties for Image to be created with them. properties['extra_properties'] = image_properties script_utils.set_base_image_properties(properties=properties) image = image_factory.new_image(**properties) image_repo.add(image) return image
def create_image(image_repo, image_factory, image_properties, task_id): _base_properties = [] for k, v in v2_api.get_base_properties().items(): _base_properties.append(k) properties = {} # NOTE: get the base properties for key in _base_properties: try: properties[key] = image_properties.pop(key) except KeyError: msg = ( "Task ID %(task_id)s: Ignoring property %(k)s for setting " "base properties while creating " "Image." ) % {"task_id": task_id, "k": key} LOG.debug(msg) # NOTE: get the rest of the properties and pass them as # extra_properties for Image to be created with them. properties["extra_properties"] = image_properties script_utils.set_base_image_properties(properties=properties) image = image_factory.new_image(**properties) image_repo.add(image) return image