"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zaqar/transport/wsgi/v1_1/pools.py" between
zaqar-9.0.0.tar.gz and zaqar-10.0.0.tar.gz

About: OpenStack Zaqar is a multi-tenant cloud messaging and notification service for web and mobile developers.
The "Ussuri" series (latest release).

pools.py  (zaqar-9.0.0):pools.py  (zaqar-10.0.0)
skipping to change at line 183 skipping to change at line 183
raise wsgi_errors.HTTPBadRequestBody( raise wsgi_errors.HTTPBadRequestBody(
'cannot connect to %s' % data['uri'] 'cannot connect to %s' % data['uri']
) )
try: try:
self._ctrl.create(pool, weight=data['weight'], self._ctrl.create(pool, weight=data['weight'],
uri=data['uri'], uri=data['uri'],
options=data.get('options', {})) options=data.get('options', {}))
response.status = falcon.HTTP_201 response.status = falcon.HTTP_201
response.location = request.path response.location = request.path
except errors.PoolCapabilitiesMismatch as e: except errors.PoolCapabilitiesMismatch as e:
LOG.exception(e)
title = _(u'Unable to create pool') title = _(u'Unable to create pool')
LOG.exception(title)
raise falcon.HTTPBadRequest(title, six.text_type(e)) raise falcon.HTTPBadRequest(title, six.text_type(e))
except errors.PoolAlreadyExists as e: except errors.PoolAlreadyExists as e:
LOG.exception(e) LOG.exception('Pool "%s" already exists', pool)
raise wsgi_errors.HTTPConflict(six.text_type(e)) raise wsgi_errors.HTTPConflict(six.text_type(e))
def on_delete(self, request, response, project_id, pool): def on_delete(self, request, response, project_id, pool):
"""Deregisters a pool. """Deregisters a pool.
:returns: HTTP | [204, 403] :returns: HTTP | [204, 403]
""" """
LOG.debug(u'DELETE pool - name: %s', pool) LOG.debug(u'DELETE pool - name: %s', pool)
try: try:
self._ctrl.delete(pool) self._ctrl.delete(pool)
except errors.PoolInUseByFlavor as ex: except errors.PoolInUseByFlavor as ex:
LOG.exception(ex)
title = _(u'Unable to delete') title = _(u'Unable to delete')
description = _(u'This pool is used by flavors {flavor}; ' description = _(u'This pool is used by flavors {flavor}; '
u'It cannot be deleted.') u'It cannot be deleted.')
description = description.format(flavor=ex.flavor) description = description.format(flavor=ex.flavor)
LOG.exception(description)
raise falcon.HTTPForbidden(title, description) raise falcon.HTTPForbidden(title, description)
response.status = falcon.HTTP_204 response.status = falcon.HTTP_204
def on_patch(self, request, response, project_id, pool): def on_patch(self, request, response, project_id, pool):
"""Allows one to update a pool's weight, uri, and/or options. """Allows one to update a pool's weight, uri, and/or options.
This method expects the user to submit a JSON object This method expects the user to submit a JSON object
containing at least one of: 'uri', 'weight', 'group', 'options'. If containing at least one of: 'uri', 'weight', 'group', 'options'. If
none are found, the request is flagged as bad. There is also none are found, the request is flagged as bad. There is also
skipping to change at line 249 skipping to change at line 249
conf=conf): conf=conf):
raise wsgi_errors.HTTPBadRequestBody( raise wsgi_errors.HTTPBadRequestBody(
'cannot connect to %s' % data['uri'] 'cannot connect to %s' % data['uri']
) )
fields = common_utils.fields(data, EXPECT, fields = common_utils.fields(data, EXPECT,
pred=lambda v: v is not None) pred=lambda v: v is not None)
try: try:
self._ctrl.update(pool, **fields) self._ctrl.update(pool, **fields)
except errors.PoolDoesNotExist as ex: except errors.PoolDoesNotExist as ex:
LOG.exception(ex) LOG.exception('Pool "%s" does not exist', pool)
raise wsgi_errors.HTTPNotFound(six.text_type(ex)) raise wsgi_errors.HTTPNotFound(six.text_type(ex))
 End of changes. 6 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)