Esempio n. 1
0
"""Init package."""
import os

from orm.common.orm_common.injector import injector
import orm.services.image_manager.ims.di_providers as di_providers
from orm.services.image_manager.ims.logger import get_logger

logger = get_logger(__name__)

_current_dirname = os.path.dirname(os.path.realpath(di_providers.__file__))
injector.register_providers('IMS_ENV', _current_dirname, logger)
Esempio n. 2
0
import time

from orm.common.orm_common.injector import injector
from orm.services.image_manager.ims.logger import get_logger
from orm.services.image_manager.ims.logic.error_base import ErrorStatus, NotFoundError
from orm.services.image_manager.ims.persistency.sql_alchemy.db_models import ImageCustomer, ImageRegion
from orm.services.image_manager.ims.persistency.wsme.models import (ImageSummary, ImageSummaryResponse,
                                                                    ImageWrapper, RegionWrapper)
from orm.services.image_manager.ims.utils import utils as ImsUtils

LOG = get_logger(__name__)

di = injector.get_di()


@di.dependsOn('data_manager')
def create_image(image_wrapper, image_uuid, transaction_id):
    DataManager = di.resolver.unpack(create_image)
    datamanager = DataManager()

    image_wrapper.image.id = image_uuid

    image_wrapper.image.created_at = str(int(time.time()))
    image_wrapper.image.updated_at = image_wrapper.image.created_at

    try:
        image_wrapper.handle_region_group()
        image_wrapper.validate_model()
        sql_image = image_wrapper.to_db_model()

        image_rec = datamanager.get_record('image')