def get_image_factory(self, context): image_factory = glance.domain.ImageFactory() store_image_factory = glance.location.ImageFactoryProxy( image_factory, context, self.store_api, self.store_utils) quota_image_factory = glance.quota.ImageFactoryProxy( store_image_factory, context, self.db_api, self.store_utils) policy_image_factory = policy.ImageFactoryProxy( quota_image_factory, context, self.policy) notifier_image_factory = glance.notifier.ImageFactoryProxy( policy_image_factory, context, self.notifier) if property_utils.is_property_protection_enabled(): property_rules = property_utils.PropertyRules(self.policy) protected_image_factory = property_protections.\ ProtectedImageFactoryProxy(notifier_image_factory, context, property_rules) authorized_image_factory = authorization.ImageFactoryProxy( protected_image_factory, context) else: authorized_image_factory = authorization.ImageFactoryProxy( notifier_image_factory, context) if CONF.sync_enabled: sync_image_factory = glance.sync.ImageFactoryProxy( authorized_image_factory, context, self.sync_api) return sync_image_factory return authorized_image_factory
def get_image_factory(self, context): image_factory = glance.domain.ImageFactory() store_image_factory = glance.store.ImageFactoryProxy( image_factory, context, self.store_api) policy_image_factory = policy.ImageFactoryProxy( store_image_factory, context, self.policy) notifier_image_factory = glance.notifier.ImageFactoryProxy( policy_image_factory, context, self.notifier) authorized_image_factory = authorization.ImageFactoryProxy( notifier_image_factory, context) return authorized_image_factory
def get_image_factory(self, context): image_factory = glance.domain.ImageFactory() store_image_factory = glance.location.ImageFactoryProxy( image_factory, context, self.store_api, self.store_utils) #配额包装层 quota_image_factory = glance.quota.ImageFactoryProxy( store_image_factory, context, self.db_api, self.store_utils) #策略包装层 policy_image_factory = policy.ImageFactoryProxy( quota_image_factory, context, self.policy) #通知包装层 notifier_image_factory = glance.notifier.ImageFactoryProxy( policy_image_factory, context, self.notifier) if property_utils.is_property_protection_enabled(): property_rules = property_utils.PropertyRules(self.policy) pif = property_protections.ProtectedImageFactoryProxy( notifier_image_factory, context, property_rules) authorized_image_factory = authorization.ImageFactoryProxy( pif, context) else: authorized_image_factory = authorization.ImageFactoryProxy( notifier_image_factory, context) return authorized_image_factory
def get_image_factory(self, context, authorization_layer=True): factory = glance.domain.ImageFactory() factory = glance.location.ImageFactoryProxy(factory, context, self.store_api, self.store_utils) factory = glance.quota.ImageFactoryProxy(factory, context, self.db_api, self.store_utils) if authorization_layer: factory = policy.ImageFactoryProxy(factory, context, self.policy) factory = glance.notifier.ImageFactoryProxy(factory, context, self.notifier) if property_utils.is_property_protection_enabled(): property_rules = property_utils.PropertyRules(self.policy) factory = property_protections.ProtectedImageFactoryProxy( factory, context, property_rules) if authorization_layer: factory = authorization.ImageFactoryProxy(factory, context) return factory
def setUp(self): super(TestImageFactoryProxy, self).setUp() factory = glance.domain.ImageFactory() self.context = glance.context.RequestContext(tenant=TENANT1) self.image_factory = authorization.ImageFactoryProxy(factory, self.context)