~ubuntu-branches/ubuntu/quantal/glance/quantal

« back to all changes in this revision

Viewing changes to glance/common/auth.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandleman
  • Date: 2012-01-26 09:22:37 UTC
  • mfrom: (1.1.25)
  • Revision ID: package-import@ubuntu.com-20120126092237-3wvlfjtg0ut3231r
Tags: 2012.1~e3-0ubuntu1
[Chuck Short]
* New upstream version.
* debian/control: Add python-crypto as a build dependency.

[Adam Gandleman]
* debian/glance-api.install: Add policy.json

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
 
141
141
        resp, resp_body = self._do_request(token_url, 'GET', headers=headers)
142
142
 
 
143
        def _management_url(self, resp):
 
144
            for url_header in ('x-image-management-url',
 
145
                               'x-server-management-url',
 
146
                               'x-glance'):
 
147
                try:
 
148
                    return resp[url_header]
 
149
                except KeyError as e:
 
150
                    not_found = e
 
151
            raise not_found
 
152
 
143
153
        if resp.status in (200, 204):
144
154
            try:
145
 
                self.management_url = resp['x-server-management-url']
 
155
                self.management_url = _management_url(self, resp)
146
156
                self.auth_token = resp['x-auth-token']
147
157
            except KeyError:
148
158
                raise exception.AuthorizationFailure()