~ubuntu-branches/ubuntu/saucy/heat/saucy-updates

« back to all changes in this revision

Viewing changes to heat/common/exception.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-08 15:23:59 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20130808152359-187gmaw0nx1oduxy
Tags: upstream-2013.2~b2.a186.g2b4b248
ImportĀ upstreamĀ versionĀ 2013.2~b2.a186.g2b4b248

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import functools
21
21
import urlparse
22
22
import sys
 
23
from heat.openstack.common import exception
23
24
from heat.openstack.common.gettextutils import _
24
 
from heat.openstack.common import exception
25
25
 
26
26
 
27
27
OpenstackException = exception.OpenstackException
248
248
                "in Stack %(stack_name)s.")
249
249
 
250
250
 
 
251
class ResourceTypeNotFound(OpenstackException):
 
252
    message = _("The Resource Type (%(type_name)s) could not be found.")
 
253
 
 
254
 
251
255
class ResourceNotAvailable(OpenstackException):
252
256
    message = _("The Resource (%(resource_name)s) is not available.")
253
257
 
260
264
    message = _("The Watch Rule (%(watch_name)s) could not be found.")
261
265
 
262
266
 
 
267
class ActionInProgress(OpenstackException):
 
268
    message = _("Stack %(stack_name)s already has an action (%(action)s) "
 
269
                "in progress")
 
270
 
 
271
 
263
272
class ResourceFailure(OpenstackException):
264
273
    message = _("%(exc_type)s: %(message)s")
265
274
 
266
 
    def __init__(self, exception):
 
275
    def __init__(self, exception, resource, action=None):
267
276
        if isinstance(exception, ResourceFailure):
268
277
            exception = getattr(exception, 'exc', exception)
269
278
        self.exc = exception
 
279
        self.resource = resource
 
280
        self.action = action
270
281
        exc_type = type(exception).__name__
271
282
        super(ResourceFailure, self).__init__(exc_type=exc_type,
272
283
                                              message=str(exception))
 
284
 
 
285
 
 
286
class NotSupported(OpenstackException):
 
287
    message = _("%(feature)s is not supported.")
 
288
 
 
289
 
 
290
class ResourcePropertyConflict(OpenstackException):
 
291
    message = _('Cannot define the following properties at the same time: %s.')
 
292
 
 
293
    def __init__(self, *args):
 
294
        self.message = self.message % ", ".join(args)
 
295
        super(ResourcePropertyConflict, self).__init__()