exceptions.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # -*- coding: utf-8 -*-
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS,
  10. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  11. # implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. __all__ = (
  15. 'PackStackError',
  16. 'InstallError',
  17. 'FlagValidationError',
  18. 'MissingRequirements',
  19. 'PluginError',
  20. 'ParamProcessingError',
  21. 'ParamValidationError',
  22. 'NetworkError',
  23. 'ScriptRuntimeError',
  24. )
  25. class PackStackError(Exception):
  26. """Default Exception class for packstack installer."""
  27. def __init__(self, *args, **kwargs):
  28. super(PackStackError, self).__init__(*args)
  29. self.stdout = kwargs.get('stdout', None)
  30. self.stderr = kwargs.get('stderr', None)
  31. class PuppetError(Exception):
  32. """Raised when Puppet will have some problems."""
  33. class MissingRequirements(PackStackError):
  34. """Raised when minimum install requirements are not met."""
  35. pass
  36. class InstallError(PackStackError):
  37. """Exception for generic errors during setup run."""
  38. pass
  39. class FlagValidationError(InstallError):
  40. """Raised when single flag validation fails."""
  41. pass
  42. class ParamValidationError(InstallError):
  43. """Raised when parameter value validation fails."""
  44. pass
  45. class PluginError(PackStackError):
  46. pass
  47. class ParamProcessingError(PluginError):
  48. pass
  49. class NetworkError(PackStackError):
  50. """Should be used for packstack's network failures."""
  51. pass
  52. class ScriptRuntimeError(PackStackError):
  53. """
  54. Raised when utils.ScriptRunner.execute does not end successfully.
  55. """
  56. pass
  57. class ExecuteRuntimeError(PackStackError):
  58. """Raised when utils.execute does not end successfully."""
  59. class SequenceError(PackStackError):
  60. """Exception for errors during setup sequence run."""
  61. pass