vFW and vDNS support added to azure-plugin
[multicloud/azure.git] / azure / aria / aria-extension-cloudify / src / aria / aria / orchestrator / workflows / exceptions.py
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 """
17 Workflow exceptions.
18 """
19
20 import os
21
22 from .. import exceptions
23
24
25 class ExecutorException(exceptions.AriaError):
26     """
27     General executor exception.
28     """
29     pass
30
31
32 class ProcessException(ExecutorException):
33     """
34     Raised when subprocess execution fails.
35     """
36
37     def __init__(self, command, stderr=None, stdout=None, return_code=None):
38         """
39         Process class Exception
40         :param list command: child process command
41         :param str message: custom message
42         :param str stderr: child process stderr
43         :param str stdout: child process stdout
44         :param int return_code: child process exit code
45         """
46         super(ProcessException, self).__init__("child process failed")
47         self.command = command
48         self.stderr = stderr
49         self.stdout = stdout
50         self.return_code = return_code
51
52     @property
53     def explanation(self):
54         """
55         Describes the error in detail
56         """
57         return (
58             'Command "{error.command}" executed with an error.{0}'
59             'code: {error.return_code}{0}'
60             'error: {error.stderr}{0}'
61             'output: {error.stdout}'.format(os.linesep, error=self))
62
63
64 class AriaEngineError(exceptions.AriaError):
65     """
66     Raised by the workflow engine.
67     """
68
69
70 class TaskException(exceptions.AriaError):
71     """
72     Raised by the task.
73     """
74
75
76 class TaskCreationException(TaskException):
77     """
78     Could not create the task.
79     """
80
81
82 class OperationNotFoundException(TaskCreationException):
83     """
84     Could not find an operation on the node or relationship.
85     """
86
87
88 class PluginNotFoundException(TaskCreationException):
89     """
90     Could not find a plugin matching the plugin specification.
91     """