Example #1
0
 def delete_actions(self):
     auth_plugin = pecan.request.environ.get('keystone.token_auth')
     for action in itertools.chain(self.ok_actions, self.alarm_actions,
                                   self.insufficient_data_actions):
         url = netutils.urlsplit(action)
         if self._is_trust_url(url) and url.password:
             keystone_client.delete_trust_id(url.username, auth_plugin)
Example #2
0
 def update_actions(self, old_alarm=None):
     trustor_user_id = pecan.request.headers.get('X-User-Id')
     trustor_project_id = pecan.request.headers.get('X-Project-Id')
     roles = pecan.request.headers.get('X-Roles', '')
     if roles:
         roles = roles.split(',')
     else:
         roles = []
     auth_plugin = pecan.request.environ.get('keystone.token_auth')
     for actions in (self.ok_actions, self.alarm_actions,
                     self.insufficient_data_actions):
         if actions is not None:
             for index, action in enumerate(actions[:]):
                 url = netutils.urlsplit(action)
                 if self._is_trust_url(url):
                     if '@' not in url.netloc:
                         # We have a trust action without a trust ID,
                         # create it
                         trust_id = keystone_client.create_trust_id(
                             trustor_user_id, trustor_project_id, roles,
                             auth_plugin)
                         netloc = '%s:delete@%s' % (trust_id, url.netloc)
                         url = list(url)
                         url[1] = netloc
                         actions[index] = urlparse.urlunsplit(url)
     if old_alarm:
         for key in ('ok_actions', 'alarm_actions',
                     'insufficient_data_actions'):
             for action in getattr(old_alarm, key):
                 url = netutils.urlsplit(action)
                 if (self._is_trust_url(url) and url.password and
                         action not in getattr(self, key)):
                     keystone_client.delete_trust_id(
                         url.username, auth_plugin)
Example #3
0
 def delete_actions(self):
     auth_plugin = pecan.request.environ.get('keystone.token_auth')
     for action in itertools.chain(self.ok_actions, self.alarm_actions,
                                   self.insufficient_data_actions):
         url = netutils.urlsplit(action)
         if self._is_trust_url(url) and url.password:
             keystone_client.delete_trust_id(url.username, auth_plugin)
Example #4
0
 def update_actions(self, old_alarm=None):
     trustor_user_id = pecan.request.headers.get('X-User-Id')
     trustor_project_id = pecan.request.headers.get('X-Project-Id')
     roles = pecan.request.headers.get('X-Roles', '')
     if roles:
         roles = roles.split(',')
     else:
         roles = []
     auth_plugin = pecan.request.environ.get('keystone.token_auth')
     for actions in (self.ok_actions, self.alarm_actions,
                     self.insufficient_data_actions):
         if actions is not None:
             for index, action in enumerate(actions[:]):
                 url = netutils.urlsplit(action)
                 if self._is_trust_url(url):
                     if '@' not in url.netloc:
                         # We have a trust action without a trust ID,
                         # create it
                         trust_id = keystone_client.create_trust_id(
                             trustor_user_id, trustor_project_id, roles,
                             auth_plugin)
                         netloc = '%s:delete@%s' % (trust_id, url.netloc)
                         url = list(url)
                         url[1] = netloc
                         actions[index] = urlparse.urlunsplit(url)
     if old_alarm:
         for key in ('ok_actions', 'alarm_actions',
                     'insufficient_data_actions'):
             for action in getattr(old_alarm, key):
                 url = netutils.urlsplit(action)
                 if (self._is_trust_url(url) and url.password
                         and action not in getattr(self, key)):
                     keystone_client.delete_trust_id(
                         url.username, auth_plugin)
Example #5
0
 def delete_trust(self, action):
     auth_plugin = pecan.request.environ.get('keystone.token_auth')
     url = netutils.urlsplit(action)
     if self._is_trust_url(url) and url.password:
         keystone_client.delete_trust_id(url.username, auth_plugin)
Example #6
0
 def delete_trust(self, action):
     auth_plugin = pecan.request.environ.get('keystone.token_auth')
     url = netutils.urlsplit(action)
     if self._is_trust_url(url) and url.password:
         keystone_client.delete_trust_id(url.username, auth_plugin)