예제 #1
0
 def update_policy(self, policy_id, policy):
     if 'id' in policy and policy_id != policy['id']:
         raise exception.ValidationError('Cannot change policy ID')
     try:
         return self.driver.update_policy(policy_id, policy)
     except exception.NotFound:
         raise exception.PolicyNotFound(policy_id=policy_id)
예제 #2
0
 def delete_policy(self, policy_id, initiator=None):
     try:
         ret = self.driver.delete_policy(policy_id)
     except exception.NotFound:
         raise exception.PolicyNotFound(policy_id=policy_id)
     notifications.Audit.deleted(self._POLICY, policy_id, initiator)
     return ret
예제 #3
0
 def update_policy(self, policy_id, policy, initiator=None):
     if 'id' in policy and policy_id != policy['id']:
         raise exception.ValidationError('Cannot change policy ID')
     try:
         ref = self.driver.update_policy(policy_id, policy)
     except exception.NotFound:
         raise exception.PolicyNotFound(policy_id=policy_id)
     notifications.Audit.updated(self._POLICY, policy_id, initiator)
     return ref
예제 #4
0
 def delete_policy(self, policy_id):
     try:
         return self.driver.delete_policy(policy_id)
     except exception.NotFound:
         raise exception.PolicyNotFound(policy_id=policy_id)
예제 #5
0
 def _get_policy(self, session, policy_id):
     """Private method to get a policy model object (NOT a dictionary)."""
     ref = session.query(PolicyModel).get(policy_id)
     if not ref:
         raise exception.PolicyNotFound(policy_id=policy_id)
     return ref
예제 #6
0
파일: sql.py 프로젝트: dionjp/keystone
 def _get_policy(self, session, policy_id):
     """Private method to get a policy model object (NOT a dictionary)."""
     try:
         return session.query(PolicyModel).filter_by(id=policy_id).one()
     except sql.NotFound:
         raise exception.PolicyNotFound(policy_id=policy_id)
예제 #7
0
 def get_policy(self, context, policy_id):
     try:
         return self.driver.get_policy(policy_id)
     except exception.NotFound:
         raise exception.PolicyNotFound(policy_id=policy_id)