Example #1
0
 def _get_domain(self, session, domain_id):
     ref = session.query(Domain).get(domain_id)
     if ref is None:
         raise exception.DomainNotFound(domain_id=domain_id)
     return ref
Example #2
0
 def get_domain(self, domain_id):
     try:
         return self.db.get('domain-%s' % domain_id)
     except exception.NotFound:
         raise exception.DomainNotFound(domain_id=domain_id)
Example #3
0
 def get_domain_by_name(self, domain_name):
     try:
         return self.db.get('domain_name-%s' % domain_name)
     except exception.NotFound:
         raise exception.DomainNotFound(domain_id=domain_name)
Example #4
0
    def _validate_default_domain_id(self, domain_id):
        """Validate that the domain ID specified belongs to the default domain.

        """
        if domain_id != CONF.identity.default_domain_id:
            raise exception.DomainNotFound(domain_id=domain_id)
Example #5
0
 def get_domain_by_name(self, domain_name):
     default_domain = assignment.calc_default_domain()
     if domain_name != default_domain['name']:
         raise exception.DomainNotFound(domain_id=domain_name)
     return default_domain
Example #6
0
 def get_domain(self, domain_id):
     session = self.get_session()
     ref = session.query(Domain).filter_by(id=domain_id).first()
     if ref is None:
         raise exception.DomainNotFound(domain_id=domain_id)
     return ref.to_dict()
Example #7
0
 def get(self, id, filter=None):
     """Replaces exception.NotFound with exception.DomainNotFound."""
     try:
         return super(DomainApi, self).get(id, filter)
     except exception.NotFound:
         raise exception.DomainNotFound(domain_id=id)
Example #8
0
 def delete_domain(self, domain_id):
     try:
         return self.domain.delete(domain_id)
     except ldap.NO_SUCH_OBJECT:
         raise exception.DomainNotFound(domain_id=domain_id)