101 lines
3.3 KiB
Python
101 lines
3.3 KiB
Python
# Copyright 2017 The Armada Authors.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from armada.exceptions import base_exception
|
|
|
|
|
|
class ArmadaException(base_exception.ArmadaBaseException):
|
|
'''Base class for Armada handler exception and error handling.'''
|
|
|
|
message = 'An unknown Armada handler error occurred.'
|
|
|
|
|
|
class ArmadaTimeoutException(ArmadaException):
|
|
'''Exception that occurs when Armada times out while processing.'''
|
|
|
|
def __init__(self, reason):
|
|
self._message = 'Armada timed out waiting on: %s' % (reason)
|
|
super(ArmadaTimeoutException, self).__init__(self._message)
|
|
|
|
|
|
class ProtectedReleaseException(ArmadaException):
|
|
'''
|
|
Exception that occurs when Armada encounters a FAILED release that is
|
|
designated `protected` in the Chart and `continue_processing` is False.
|
|
'''
|
|
|
|
def __init__(self, reason):
|
|
self._message = (
|
|
'Armada encountered protected release %s in FAILED status' %
|
|
reason)
|
|
super(ProtectedReleaseException, self).__init__(self._message)
|
|
|
|
|
|
class InvalidValuesYamlException(ArmadaException):
|
|
'''
|
|
Exception that occurs when Armada encounters invalid values.yaml content in
|
|
a helm chart.
|
|
'''
|
|
|
|
def __init__(self, chart_description):
|
|
self._message = (
|
|
'Armada encountered invalid values.yaml in helm chart: %s' %
|
|
chart_description)
|
|
super(InvalidValuesYamlException, self).__init__(self._message)
|
|
|
|
|
|
class InvalidOverrideValuesYamlException(ArmadaException):
|
|
'''
|
|
Exception that occurs when Armada encounters invalid override yaml in
|
|
helm chart.
|
|
'''
|
|
|
|
def __init__(self, chart_description):
|
|
self._message = (
|
|
'Armada encountered invalid values.yaml in helm chart: %s' %
|
|
chart_description)
|
|
super(InvalidValuesYamlException, self).__init__(self._message)
|
|
|
|
|
|
class ChartDeployException(ArmadaException):
|
|
'''
|
|
Exception that occurs while deploying charts.
|
|
'''
|
|
|
|
def __init__(self, chart_names):
|
|
self._message = ('Exception deploying charts: %s' % chart_names)
|
|
super(ChartDeployException, self).__init__(self._message)
|
|
|
|
|
|
class WaitException(ArmadaException):
|
|
'''
|
|
Exception that occurs while waiting for resources to become ready.
|
|
'''
|
|
|
|
def __init__(self, message):
|
|
self._message = message
|
|
super(WaitException, self).__init__(message)
|
|
|
|
|
|
class UnexpectedReleaseStatusException(ArmadaException):
|
|
'''
|
|
Exception that occurs when armada encounters an existing release for a
|
|
chart with an unexpected status which armada does not know what to do with.
|
|
'''
|
|
|
|
def __init__(self, release_name, status):
|
|
self._message = "Found release {} in unexpected status {}".format(
|
|
release_name, status)
|
|
super(UnexpectedReleaseStatusException, self).__init__(self._message)
|