~ubuntu-branches/ubuntu/wily/heat/wily

« back to all changes in this revision

Viewing changes to heat/engine/clients/os/keystone.py

  • Committer: Package Import Robot
  • Author(s): Corey Bryant
  • Date: 2015-09-08 15:52:07 UTC
  • mfrom: (1.1.28)
  • Revision ID: package-import@ubuntu.com-20150908155207-zi2r1rckyrevr5u7
Tags: 1:5.0.0~b3-0ubuntu1
* New upstream milestone for OpenStack Liberty.
* d/control: Align (build-)depends with upstream.
* d/p/fix-dummy-resource-missing.patch: Dropped. Fixed in milestone.
* d/p/move-extensions.patch: Dropped. Fixed in milestone.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
                raise exception.EntityNotFound(entity='KeystoneService',
102
102
                                               name=service)
103
103
 
 
104
    def get_user_id(self, user):
 
105
        try:
 
106
            user_obj = self.client().client.users.get(user)
 
107
            return user_obj.id
 
108
        except exceptions.NotFound:
 
109
            user_list = self.client().client.users.list(name=user)
 
110
            for user_obj in user_list:
 
111
                if user_obj.name == user:
 
112
                    return user_obj.id
 
113
 
 
114
        raise exception.EntityNotFound(entity='KeystoneUser', name=user)
 
115
 
104
116
 
105
117
class KeystoneRoleConstraint(constraints.BaseCustomConstraint):
106
118
 
141
153
 
142
154
    def validate_with_client(self, client, service):
143
155
        client.client_plugin('keystone').get_service_id(service)
 
156
 
 
157
 
 
158
class KeystoneUserConstraint(constraints.BaseCustomConstraint):
 
159
 
 
160
    expected_exceptions = (exception.EntityNotFound,)
 
161
 
 
162
    def validate_with_client(self, client, user):
 
163
        client.client_plugin('keystone').get_user_id(user)