From 54c3ebd63efbe21ed964cd8ee11274a5c2d95390 Mon Sep 17 00:00:00 2001 From: Sergiy Markin Date: Tue, 17 Dec 2024 14:59:29 +0000 Subject: [PATCH] Airflow and Openstack modules upgrade This PS upgrades Airflow to 2.10.4 and Openstack modules to 2024.1 Caracal versions Change-Id: I66aa7acfdaa5ffa6947856691dd69219be54976c --- .zuul.yaml | 2 +- .style.yapf => armada/.style.yapf | 2 +- armada/api/controller/armada.py | 1 - armada/api/controller/health.py | 1 - armada/api/controller/metrics.py | 1 - armada/api/controller/test.py | 2 - armada/api/controller/validation.py | 1 - armada/api/controller/versions.py | 1 - armada/common/session.py | 2 - armada/conf/__init__.py | 1 - armada/conf/default.py | 3 +- armada/exceptions/armada_exceptions.py | 8 -- armada/exceptions/base_exception.py | 41 +++---- armada/exceptions/chartbuilder_exceptions.py | 1 - armada/exceptions/helm_exceptions.py | 1 - armada/exceptions/override_exceptions.py | 4 - armada/exceptions/source_exceptions.py | 9 -- armada/handlers/armada.py | 1 - armada/handlers/chartbuilder.py | 1 - armada/handlers/document.py | 1 - armada/handlers/helm.py | 8 +- armada/handlers/k8s.py | 1 - armada/handlers/lock.py | 3 +- armada/handlers/release_diff.py | 1 - armada/handlers/test.py | 8 +- armada/handlers/wait.py | 6 +- armada/tests/test_utils.py | 2 - armada/tests/unit/api/base.py | 1 - armada/tests/unit/api/test_test_controller.py | 29 +++-- armada/tests/unit/fixtures.py | 2 - armada/tests/unit/handlers/test_armada.py | 10 +- armada/tests/unit/handlers/test_manifest.py | 12 +- armada/tests/unit/handlers/test_override.py | 9 +- armada/tests/unit/utils/schema.py | 4 +- armada/tests/unit/utils/test_validate.py | 3 +- armada/utils/validation_message.py | 1 - doc/source/conf.py | 4 +- requirements-direct.txt | 39 ++++--- requirements-frozen.txt | 106 ++++++++++++------ setup.cfg | 1 + setup.py | 9 +- test-requirements.txt | 10 +- tox.ini | 3 +- 43 files changed, 185 insertions(+), 171 deletions(-) rename .style.yapf => armada/.style.yapf (87%) diff --git a/.zuul.yaml b/.zuul.yaml index ee306f85..7096dc30 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -201,7 +201,7 @@ commit: true static: - latest - - airflow_2.10.2 + - airflow_2.10.4 - secret: diff --git a/.style.yapf b/armada/.style.yapf similarity index 87% rename from .style.yapf rename to armada/.style.yapf index 1c23de01..808516c0 100644 --- a/.style.yapf +++ b/armada/.style.yapf @@ -6,5 +6,5 @@ blank_line_before_nested_class_or_def = false blank_line_before_module_docstring = true split_before_logical_operator = true split_before_first_argument = true -allow_split_before_dict_value = false +allow_split_before_dict_value = true split_before_arithmetic_operator = true diff --git a/armada/api/controller/armada.py b/armada/api/controller/armada.py index 053c8eb4..90bb6c13 100644 --- a/armada/api/controller/armada.py +++ b/armada/api/controller/armada.py @@ -30,7 +30,6 @@ class Apply(api.BaseResource): """Controller for installing and updating charts defined in an Armada manifest file. """ - @policy.enforce('armada:create_endpoints') def on_post(self, req, resp): # Load data from request and get options diff --git a/armada/api/controller/health.py b/armada/api/controller/health.py index f6467daa..45e715e5 100644 --- a/armada/api/controller/health.py +++ b/armada/api/controller/health.py @@ -20,7 +20,6 @@ class Health(api.BaseResource): """ Return empty response/body to show that Armada is healthy. """ - def on_get(self, req, resp): """ It really does nothing right now. It may do more later. diff --git a/armada/api/controller/metrics.py b/armada/api/controller/metrics.py index 263d18c4..d8578c19 100644 --- a/armada/api/controller/metrics.py +++ b/armada/api/controller/metrics.py @@ -22,7 +22,6 @@ from armada.handlers import metrics class Metrics(api.BaseResource): '''Controller for exporting prometheus metrics. ''' - def on_get(self, req, resp): encoder, content_type = prometheus_client.exposition.choose_encoder( req.get_header('Accept')) diff --git a/armada/api/controller/test.py b/armada/api/controller/test.py index a032ae84..2524250f 100644 --- a/armada/api/controller/test.py +++ b/armada/api/controller/test.py @@ -35,7 +35,6 @@ class TestReleasesReleaseNameController(api.BaseResource): ''' Test Helm releases via release name. ''' - @policy.enforce('armada:test_release') def on_get(self, req, resp, namespace, release): try: @@ -71,7 +70,6 @@ class TestReleasesManifestController(api.BaseResource): ''' Test Helm releases via a Manifest. ''' - def _format_validation_response(self, req, resp, result, details): resp.content_type = 'application/json' resp_body = { diff --git a/armada/api/controller/validation.py b/armada/api/controller/validation.py index bf440635..8f387fa7 100644 --- a/armada/api/controller/validation.py +++ b/armada/api/controller/validation.py @@ -26,7 +26,6 @@ from armada.handlers.document import ReferenceResolver class Validate(api.BaseResource): '''Controller for validating an Armada manifest. ''' - @policy.enforce('armada:validate_manifest') def on_post(self, req, resp): try: diff --git a/armada/api/controller/versions.py b/armada/api/controller/versions.py index 975000a6..e7e2ff79 100644 --- a/armada/api/controller/versions.py +++ b/armada/api/controller/versions.py @@ -24,7 +24,6 @@ class Versions(api.BaseResource): Returns the list of supported versions of the Armada API. """ - def on_get(self, req, resp): resp.status = falcon.HTTP_200 resp.text = json.dumps( diff --git a/armada/common/session.py b/armada/common/session.py index f4c3de8f..807f13bf 100644 --- a/armada/common/session.py +++ b/armada/common/session.py @@ -37,7 +37,6 @@ class ArmadaSession(object): value may also be supplied instead of a tuple to indicate only the read timeout to use """ - def __init__( self, host, @@ -186,7 +185,6 @@ class ArmadaSession(object): class TcpKeepaliveAdapter(requests.adapters.HTTPAdapter): """"Transport adapter" that enables TCP keepalives.""" - def init_poolmanager(self, connections, maxsize, block=False): options = HTTPConnection.default_socket_options + [ (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), diff --git a/armada/conf/__init__.py b/armada/conf/__init__.py index 7514066b..f4bb30d3 100644 --- a/armada/conf/__init__.py +++ b/armada/conf/__init__.py @@ -84,7 +84,6 @@ class ChartDeployAwareLogger(logging.Logger): """Includes name of chart currently being deployed (if any) in log messages. """ - def _log(self, level, msg, *args, **kwargs): chart = get_current_chart() if chart: diff --git a/armada/conf/default.py b/armada/conf/default.py index 3dd2c2c3..d638e4da 100644 --- a/armada/conf/default.py +++ b/armada/conf/default.py @@ -116,7 +116,8 @@ def register_opts(conf): def list_opts(): return { - 'DEFAULT': default_options, + 'DEFAULT': + default_options, 'keystone_authtoken': ( ks_loading.get_session_conf_options() + ks_loading.get_auth_common_conf_options() diff --git a/armada/exceptions/armada_exceptions.py b/armada/exceptions/armada_exceptions.py index 8ded780d..086276fc 100644 --- a/armada/exceptions/armada_exceptions.py +++ b/armada/exceptions/armada_exceptions.py @@ -23,7 +23,6 @@ class ArmadaException(base_exception.ArmadaBaseException): 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) @@ -35,7 +34,6 @@ class ProtectedReleaseException(ArmadaException): than DEPLOYED that is designated `protected` in the Chart and `continue_processing` is False. ''' - def __init__(self, release_id, status): self._message = ( 'Armada encountered protected release {} in {} status'.format( @@ -48,7 +46,6 @@ 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' @@ -61,7 +58,6 @@ 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' @@ -73,7 +69,6 @@ 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) @@ -83,7 +78,6 @@ 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) @@ -94,7 +88,6 @@ class DeploymentLikelyPendingException(ArmadaException): Exception that occurs when it is detected that an existing release operation (e.g. install, update, delete) is likely still pending. ''' - def __init__(self, release_id, status, last_deployment_age, timeout): self._message = ( 'Existing deployment likely pending ' @@ -111,7 +104,6 @@ class PreUpdateJobDeleteException(ArmadaException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, name, namespace): message = 'Failed to delete k8s job {} in {}'.format(name, namespace) diff --git a/armada/exceptions/base_exception.py b/armada/exceptions/base_exception.py index 366014da..c51916a5 100644 --- a/armada/exceptions/base_exception.py +++ b/armada/exceptions/base_exception.py @@ -158,7 +158,7 @@ def default_error_serializer(req, resp, exception): info_list=None) -def default_exception_handler(ex, req, resp, params): +def default_exception_handler(req, resp, ex, params): """ Catch-all exception handler for standardized output. If this is a standard falcon HTTPError, rethrow it for handling @@ -186,13 +186,13 @@ class ArmadaAPIException(falcon.HTTPError): status = falcon.HTTP_500 def __init__( - self, - title=None, - description=None, - error_list=None, - info_list=None, - status=None, - retry=False, + self, + title=None, + description=None, + error_list=None, + info_list=None, + status=None, + retry=False, ): """ :param description: The internal error description @@ -206,34 +206,30 @@ class ArmadaAPIException(falcon.HTTPError): :param retry: Optional retry directive for the consumer """ - if title is None: - self.title = self.__class__.title - else: - self.title = title + # Use default title and status if none provided + status = status or self.__class__.status + title = title or self.__class__.title - if status is None: - self.status = self.__class__.status - else: - self.status = status + # Call falcon.HTTPError's constructor + super().__init__(status, title=title) + # Store custom fields as instance attributes self.description = description self.error_list = massage_error_list(error_list, description) self.info_list = info_list self.retry = retry - super().__init__( - self.status, self.title, - self._gen_ex_message(self.title, self.description)) @staticmethod def _gen_ex_message(title, description): + """Generate an exception message.""" ttl = title or 'Exception' dsc = description or 'No additional description' - return '{} : {}'.format(ttl, dsc) + return f'{ttl} : {dsc}' @staticmethod - def handle(ex, req, resp, params): + def handle(req, resp, ex, params): """ - The handler used for app errors and child classes + The handler used for app errors and child classes. """ format_error_resp( req, @@ -249,7 +245,6 @@ class ArmadaAPIException(falcon.HTTPError): class ArmadaBaseException(Exception): '''Base class for Armada exception and error handling.''' - def __init__(self, message=None, **kwargs): self.message = message or self.message # replacing try-except-pass block with suppress diff --git a/armada/exceptions/chartbuilder_exceptions.py b/armada/exceptions/chartbuilder_exceptions.py index d183d42c..620040ce 100644 --- a/armada/exceptions/chartbuilder_exceptions.py +++ b/armada/exceptions/chartbuilder_exceptions.py @@ -25,7 +25,6 @@ class HelmChartBuildException(ChartBuilderException): ''' Exception that occurs when Helm Chart fails to build. ''' - def __init__(self, chart_name, details): self._chart_name = chart_name self._message = ( diff --git a/armada/exceptions/helm_exceptions.py b/armada/exceptions/helm_exceptions.py index 29d181f3..5dfa1ec1 100644 --- a/armada/exceptions/helm_exceptions.py +++ b/armada/exceptions/helm_exceptions.py @@ -19,7 +19,6 @@ class HelmCommandException(ex): ''' Exception that occurs when a helm command fails. ''' - def __init__(self, called_process_error): self.called_process_error = called_process_error message = 'helm command failed: {}'.format( diff --git a/armada/exceptions/override_exceptions.py b/armada/exceptions/override_exceptions.py index e60108db..348f950e 100644 --- a/armada/exceptions/override_exceptions.py +++ b/armada/exceptions/override_exceptions.py @@ -28,7 +28,6 @@ class InvalidOverrideTypeException(OverrideException): Exception that occurs when an invalid override type is used with the set flag. ''' - def __init__(self, override_type): self._message = 'Override type "{}" is invalid'.format(override_type) @@ -42,7 +41,6 @@ class InvalidOverrideFileException(OverrideException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, filename): self._message = '{} is not a valid override file.'.format(filename) @@ -56,7 +54,6 @@ class InvalidOverrideValueException(OverrideException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, override_command): self._message = '{} is not a valid override statement.'.format( override_command) @@ -71,7 +68,6 @@ class UnknownDocumentOverrideException(OverrideException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, doc_type, doc_name): self._message = 'Unable to find {1} document schema: {0} '.format( doc_type, doc_name) diff --git a/armada/exceptions/source_exceptions.py b/armada/exceptions/source_exceptions.py index 6c088d78..13ca2b91 100644 --- a/armada/exceptions/source_exceptions.py +++ b/armada/exceptions/source_exceptions.py @@ -28,7 +28,6 @@ class GitException(SourceException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, location): self._location = location self._message = ( @@ -40,7 +39,6 @@ class GitException(SourceException): class GitAuthException(SourceException): '''Exception that occurs when authentication fails for cloning a repo.''' - def __init__(self, repo_url, ssh_key_path): self._repo_url = repo_url self._ssh_key_path = ssh_key_path @@ -57,7 +55,6 @@ class GitAuthException(SourceException): class GitProxyException(SourceException): '''Exception when an error occurs cloning a Git repository through a proxy.''' - def __init__(self, location): self._location = location self._message = ('Could not resolve proxy [', self._location, '].') @@ -67,7 +64,6 @@ class GitProxyException(SourceException): class GitSSHException(SourceException): '''Exception that occurs when an SSH key could not be found.''' - def __init__(self, ssh_key_path): self._ssh_key_path = ssh_key_path @@ -79,7 +75,6 @@ class GitSSHException(SourceException): class SourceCleanupException(SourceException): '''Exception that occurs for an invalid dir.''' - def __init__(self, target_dir): self._target_dir = target_dir self._message = self._target_dir + ' is not a valid directory.' @@ -95,7 +90,6 @@ class TarballDownloadException(SourceException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, tarball_url): self._tarball_url = tarball_url self._message = 'Unable to download from ' + self._tarball_url @@ -110,7 +104,6 @@ class TarballExtractException(SourceException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, tarball_dir): self._tarball_dir = tarball_dir self._message = 'Unable to extract ' + self._tarball_dir @@ -125,7 +118,6 @@ class InvalidPathException(SourceException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, path): self._path = path self._message = 'Unable to access path ' + self._path @@ -140,7 +132,6 @@ class ChartSourceException(SourceException): **Troubleshoot:** *Coming Soon* ''' - def __init__(self, chart_name, source_type): self._chart_name = chart_name self._source_type = source_type diff --git a/armada/handlers/armada.py b/armada/handlers/armada.py index e2e19345..784d8afc 100644 --- a/armada/handlers/armada.py +++ b/armada/handlers/armada.py @@ -42,7 +42,6 @@ class Armada(object): This is the main Armada class handling the Armada workflows ''' - def __init__( self, documents, diff --git a/armada/handlers/chartbuilder.py b/armada/handlers/chartbuilder.py index 761c9f60..e642d958 100644 --- a/armada/handlers/chartbuilder.py +++ b/armada/handlers/chartbuilder.py @@ -32,7 +32,6 @@ class ChartBuilder(object): This class handles taking chart intentions as a parameter and turning those into proper Helm chart metadata. ''' - @classmethod def from_chart_doc(cls, chart, helm): ''' diff --git a/armada/handlers/document.py b/armada/handlers/document.py index 3dfd5215..baedf7ef 100644 --- a/armada/handlers/document.py +++ b/armada/handlers/document.py @@ -28,7 +28,6 @@ LOG = logging.getLogger(__name__) class ReferenceResolver(object): """Class for handling different data references to resolve the data.""" - @classmethod def resolve_reference(cls, design_ref): """Resolve a reference to a design document. diff --git a/armada/handlers/helm.py b/armada/handlers/helm.py index 77661803..6a68662c 100644 --- a/armada/handlers/helm.py +++ b/armada/handlers/helm.py @@ -40,7 +40,6 @@ class Helm(object): ''' Helm CLI handler ''' - def __init__(self, bearer_token=None): self.bearer_token = bearer_token @@ -57,8 +56,11 @@ class Helm(object): LOG.info('Running command=%s', command) try: result = subprocess.run( # nosec - command, check=True, universal_newlines=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, + command, + check=True, + universal_newlines=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, timeout=timeout) except subprocess.CalledProcessError as e: raise HelmCommandException(e) diff --git a/armada/handlers/k8s.py b/armada/handlers/k8s.py index f9317176..006c6e84 100644 --- a/armada/handlers/k8s.py +++ b/armada/handlers/k8s.py @@ -33,7 +33,6 @@ class K8s(object): ''' Object to obtain the local kube config file ''' - def __init__(self, bearer_token=None): ''' Initialize connection to Kubernetes diff --git a/armada/handlers/lock.py b/armada/handlers/lock.py index ee084856..765204d9 100644 --- a/armada/handlers/lock.py +++ b/armada/handlers/lock.py @@ -49,14 +49,13 @@ def lock_and_thread(lock_name="lock"): :param lock_name: name of the lock to create """ - def lock_decorator(func): @functools.wraps(func) def func_wrapper(*args, **kwargs): bearer_token = None found_helm = False for arg in args: - if type(arg) == Helm: + if type(arg) is Helm: bearer_token = arg.bearer_token found_helm = True diff --git a/armada/handlers/release_diff.py b/armada/handlers/release_diff.py index e376c6b2..5fadfa45 100644 --- a/armada/handlers/release_diff.py +++ b/armada/handlers/release_diff.py @@ -42,7 +42,6 @@ class ReleaseDiff(object): :param new_values: The chart override values to deploy. :type new_values: dict ''' - def __init__(self, old_chart, old_values, new_chart, new_values): self.old_chart = old_chart self.old_values = old_values diff --git a/armada/handlers/test.py b/armada/handlers/test.py index 4972213f..7d73a0c3 100644 --- a/armada/handlers/test.py +++ b/armada/handlers/test.py @@ -25,7 +25,11 @@ LOG = logging.getLogger(__name__) class Test(object): def __init__( - self, chart, release_id, helm, cg_test_charts=None, + self, + chart, + release_id, + helm, + cg_test_charts=None, enable_all=False): """Initialize a test handler to run Helm tests corresponding to a release. @@ -62,7 +66,7 @@ class Test(object): self.test_enabled = True # TODO: Remove when v1 doc support is removed. - if (type(test_values) == bool): + if (type(test_values) is bool): LOG.warn( 'Boolean value for chart `test` key is deprecated and ' 'will be removed. Use `test.enabled` instead.') diff --git a/armada/handlers/wait.py b/armada/handlers/wait.py index bc6572fa..645a8ab1 100644 --- a/armada/handlers/wait.py +++ b/armada/handlers/wait.py @@ -215,7 +215,11 @@ class ChartWait(): class ResourceWait(ABC): def __init__( - self, resource_type, chart_wait, labels, get_resources, + self, + resource_type, + chart_wait, + labels, + get_resources, required=True): self.resource_type = resource_type self.chart_wait = chart_wait diff --git a/armada/tests/test_utils.py b/armada/tests/test_utils.py index f6d545ce..f70a481b 100644 --- a/armada/tests/test_utils.py +++ b/armada/tests/test_utils.py @@ -96,7 +96,6 @@ def attr(**kwargs): This decorator applies the testtools.testcase.attr if it is in the list of attributes to testtools we want to apply. """ - def decorator(f): if 'type' in kwargs and isinstance(kwargs['type'], str): f = testtools.testcase.attr(kwargs['type'])(f) @@ -112,7 +111,6 @@ class AttrDict(dict): """Allows defining objects with attributes without defining a class """ - def __init__(self, *args, **kwargs): super(AttrDict, self).__init__(*args, **kwargs) self.__dict__ = self diff --git a/armada/tests/unit/api/base.py b/armada/tests/unit/api/base.py index 3c2c6144..56400972 100644 --- a/armada/tests/unit/api/base.py +++ b/armada/tests/unit/api/base.py @@ -25,7 +25,6 @@ from armada.tests.unit import fixtures class BaseControllerTest(test_base.ArmadaTestCase): """Base class for unit testing falcon controllers.""" - def setUp(self): super(BaseControllerTest, self).setUp() # Override the default configuration file lookup with references to diff --git a/armada/tests/unit/api/test_test_controller.py b/armada/tests/unit/api/test_test_controller.py index 2a8b2b67..6066956e 100644 --- a/armada/tests/unit/api/test_test_controller.py +++ b/armada/tests/unit/api/test_test_controller.py @@ -157,10 +157,14 @@ class TestReleasesManifestControllerNegativeTest(base.BaseControllerTest): 'An error occurred while building chart group: ' 'Could not build ChartGroup named ' '"keystone-infra-services".'), - 'error': True, - 'kind': 'ValidationMessage', - 'level': 'Error', - 'name': 'ARM001', + 'error': + True, + 'kind': + 'ValidationMessage', + 'level': + 'Error', + 'name': + 'ARM001', 'documents': [] }, resp_body['details']['messageList']) self.assertEqual( @@ -196,13 +200,16 @@ class TestReleasesManifestControllerNegativeTest(base.BaseControllerTest): self.assertEqual( [ { - 'message': ( - 'An error occurred while generating the manifest: foo.' - ), - 'error': True, - 'kind': 'ValidationMessage', - 'level': 'Error', - 'name': 'ARM001', + 'message': + ('An error occurred while generating the manifest: foo.'), + 'error': + True, + 'kind': + 'ValidationMessage', + 'level': + 'Error', + 'name': + 'ARM001', 'documents': [] } ], resp_body['details']['messageList']) diff --git a/armada/tests/unit/fixtures.py b/armada/tests/unit/fixtures.py index 95cd5743..aa7b45be 100644 --- a/armada/tests/unit/fixtures.py +++ b/armada/tests/unit/fixtures.py @@ -41,7 +41,6 @@ class ConfPatcher(fixtures.Fixture): it's teardown. """ - def __init__(self, **kwargs): """Constructor @@ -69,7 +68,6 @@ class RealPolicyFixture(fixtures.Fixture): like to load and enforce the shipped default policy in tests. """ - def __init__(self, verify=True, *args, **kwargs): """Constructor for ``RealPolicyFixture``. diff --git a/armada/tests/unit/handlers/test_armada.py b/armada/tests/unit/handlers/test_armada.py index 8ebac9fb..1c8ba871 100644 --- a/armada/tests/unit/handlers/test_armada.py +++ b/armada/tests/unit/handlers/test_armada.py @@ -348,7 +348,6 @@ class ArmadaHandlerTestCase(base.ArmadaTestCase): expected_last_test_result=None, diff={'some_key': {'some diff'}}): """Test install functionality from the sync() method.""" - @mock.patch.object(armada.Armada, 'post_flight_ops') @mock.patch.object(armada, 'ChartDownload') @mock.patch('armada.handlers.chart_deploy.ChartBuilder.from_chart_doc') @@ -650,7 +649,7 @@ class ArmadaNegativeHandlerTestCase(base.ArmadaTestCase): """Test armada handling with invalid manifest.""" yaml_documents = list(yaml.safe_load_all(TEST_YAML)) error_re = ('.*Documents must include at least one of each of .*') - self.assertRaisesRegexp( + self.assertRaisesRegex( ManifestException, error_re, armada.Armada, yaml_documents[:1], mock.MagicMock()) @@ -658,10 +657,11 @@ class ArmadaNegativeHandlerTestCase(base.ArmadaTestCase): def test_armada_override_exception(self, MockChartDownload): """Test Armada checks with invalid chart override.""" yaml_documents = list(yaml.safe_load_all(TEST_YAML)) - override = ('chart:example-chart-2:name=' 'overridden', ) + override = ('chart:example-chart-2:name=' + 'overridden', ) error_re = ('is not a valid override statement') - with self.assertRaisesRegexp(InvalidOverrideValueException, error_re): + with self.assertRaisesRegex(InvalidOverrideValueException, error_re): armada.Armada(yaml_documents, mock.MagicMock(), set_ovr=override) @mock.patch.object(armada, 'ChartDownload') @@ -675,5 +675,5 @@ class ArmadaNegativeHandlerTestCase(base.ArmadaTestCase): del example_document['data']['release'] error_re = ('Invalid document .*') - with self.assertRaisesRegexp(InvalidManifestException, error_re): + with self.assertRaisesRegex(InvalidManifestException, error_re): armada.Armada(yaml_documents, mock.MagicMock(), set_ovr=None) diff --git a/armada/tests/unit/handlers/test_manifest.py b/armada/tests/unit/handlers/test_manifest.py index f76c37dd..20fe74e9 100644 --- a/armada/tests/unit/handlers/test_manifest.py +++ b/armada/tests/unit/handlers/test_manifest.py @@ -15,7 +15,7 @@ import copy import os -import testtools +import testtools import yaml from armada import exceptions @@ -345,7 +345,7 @@ class ManifestNegativeTestCase(testtools.TestCase): documents.append(documents[-1]) # Copy the last manifest. error_re = r'Multiple manifests are not supported.*' - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.ManifestException, error_re, manifest.Manifest, documents) @@ -356,7 +356,7 @@ class ManifestNegativeTestCase(testtools.TestCase): documents.append(documents[-1]) # Copy the last manifest. error_re = r'Multiple manifests are not supported.*' - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.ManifestException, error_re, manifest.Manifest, @@ -367,7 +367,7 @@ class ManifestNegativeTestCase(testtools.TestCase): error_re = ( '.*Documents must include at least one of each of .* and ' 'only one .*') - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.ManifestException, error_re, manifest.Manifest, documents) @@ -391,7 +391,7 @@ class ManifestNegativeTestCase(testtools.TestCase): armada_manifest = manifest.Manifest(self.documents) error_re = r'.*Could not find %s named "%s"' % ( schema.TYPE_CHART, 'invalid') - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.BuildChartException, error_re, armada_manifest.find_chart_document, 'invalid') @@ -399,7 +399,7 @@ class ManifestNegativeTestCase(testtools.TestCase): armada_manifest = manifest.Manifest(self.documents) error_re = r'.*Could not find %s named "%s"' % ( schema.TYPE_CHARTGROUP, 'invalid') - self.assertRaisesRegexp( + self.assertRaisesRegex( exceptions.BuildChartGroupException, error_re, armada_manifest.find_chart_group_document, 'invalid') diff --git a/armada/tests/unit/handlers/test_override.py b/armada/tests/unit/handlers/test_override.py index f67fee06..c8b5fd77 100644 --- a/armada/tests/unit/handlers/test_override.py +++ b/armada/tests/unit/handlers/test_override.py @@ -64,7 +64,8 @@ class OverrideTestCase(testtools.TestCase): documents_copy = copy.deepcopy(original_documents) values_documents = list(yaml.safe_load_all(g.read())) - override = ('manifest:simple-armada:release_prefix=' 'overridden', ) + override = ('manifest:simple-armada:release_prefix=' + 'overridden', ) # Case 1: Checking if primitive gets updated. ovr = Override(original_documents, override, [values_yaml]) ovr.update_manifests() @@ -102,7 +103,8 @@ class OverrideTestCase(testtools.TestCase): original_documents = list(yaml.safe_load_all(f.read())) original_documents[-1]['data']['test'] = {'foo': 'bar'} - override = ('manifest:simple-armada:test=' '{"foo": "bar"}', ) + override = ('manifest:simple-armada:test=' + '{"foo": "bar"}', ) ovr = Override(original_documents, override, []) self.assertRaises(json.decoder.JSONDecodeError, ovr.update_manifests) @@ -346,7 +348,8 @@ class OverrideNegativeTestCase(testtools.TestCase): with open(self.base_manifest) as f: original_documents = list(yaml.safe_load_all(f.read())) - override = ('manifest:simple-armada:name=' 'overridden', ) + override = ('manifest:simple-armada:name=' + 'overridden', ) ovr = Override(original_documents, override) self.assertRaises( override_exceptions.InvalidOverrideValueException, diff --git a/armada/tests/unit/utils/schema.py b/armada/tests/unit/utils/schema.py index 537310c1..507b047c 100644 --- a/armada/tests/unit/utils/schema.py +++ b/armada/tests/unit/utils/schema.py @@ -32,6 +32,6 @@ class SchemaTestCase(unittest.TestCase): import, and importing the schemas again in manually results in duplicates. """ - with self.assertRaisesRegexp(RuntimeError, - 'Duplicate schema specified for: .*'): + with self.assertRaisesRegex(RuntimeError, + 'Duplicate schema specified for: .*'): schema._load_schemas() diff --git a/armada/tests/unit/utils/test_validate.py b/armada/tests/unit/utils/test_validate.py index 2bf99e41..cc6c4b16 100644 --- a/armada/tests/unit/utils/test_validate.py +++ b/armada/tests/unit/utils/test_validate.py @@ -80,7 +80,6 @@ class ValidateOwnExamplesTestCase(BaseValidateTest): ``armada/examples`` passes internal Armada schema validation. """ - def test_own_document_examples(self): examples_path = os.path.join(os.getcwd(), 'examples') example_files = [ @@ -215,7 +214,7 @@ data: class ValidateNegativeTestCase(BaseValidateTest): def test_validate_no_dictionary_expect_type_error(self): expected_error = 'The provided input "invalid" must be a dictionary.' - self.assertRaisesRegexp( + self.assertRaisesRegex( TypeError, expected_error, validate.validate_armada_documents, ['invalid']) diff --git a/armada/utils/validation_message.py b/armada/utils/validation_message.py index 7125adb2..e959f8f1 100644 --- a/armada/utils/validation_message.py +++ b/armada/utils/validation_message.py @@ -31,7 +31,6 @@ class ValidationMessage(object): :param string diagnostic: Information about what lead to the message, or details for resolution. """ - def __init__( self, message='Document validation error.', diff --git a/doc/source/conf.py b/doc/source/conf.py index 47cba8f4..1caf1ffe 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -69,9 +69,9 @@ author = 'The Airship Authors' # built documents. # # The short X.Y version. -#version = u'0.2.0' +# version = u'0.2.0' # The full version, including alpha/beta/rc tags. -#release = u'0.2.0' +# release = u'0.2.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/requirements-direct.txt b/requirements-direct.txt index 362c457d..13ea0a5c 100644 --- a/requirements-direct.txt +++ b/requirements-direct.txt @@ -21,20 +21,29 @@ testtools urllib3 uWSGI -# Openstack Antelope 2023.1 -# https://releases.openstack.org/antelope/index.html -python-keystoneclient==5.1.0 +# Openstack Caracal 2024.1 +# https://releases.openstack.org/caracal/index.html +barbican==18.0.0 -keystoneauth1==5.1.2 -keystonemiddleware==10.2.0 +python-barbicanclient==5.7.0 +python-keystoneclient==5.4.0 -oslo.cache==3.3.1 -oslo.config==9.1.1 -oslo.context==5.1.1 -oslo.db==12.3.1 -oslo.i18n==6.0.0 -oslo.log==5.2.0 -oslo.middleware==5.1.1 -oslo.policy==4.1.1 -oslo.serialization==5.1.1 -oslo.utils==6.1.0 \ No newline at end of file +keystoneauth1==5.6.0 +keystonemiddleware==10.6.0 + +oslo.cache==3.7.0 +oslo.concurrency==6.0.0 +oslo.config==9.4.0 +oslo.context==5.5.0 +oslo.db==15.0.0 +oslo.i18n==6.3.0 +oslo.log==5.5.1 +oslo.messaging==14.7.2 +oslo.metrics==0.8.0 +oslo.middleware==6.1.0 +oslo.policy==4.3.0 +oslo.serialization==5.4.1 +oslo.service==3.4.1 +oslo.upgradecheck==2.3.0 +oslo.utils==7.1.0 +oslo.versionedobjects==3.3.0 \ No newline at end of file diff --git a/requirements-frozen.txt b/requirements-frozen.txt index 5c4b7498..314fc895 100644 --- a/requirements-frozen.txt +++ b/requirements-frozen.txt @@ -1,87 +1,119 @@ -alembic==1.13.2 +alembic==1.14.0 +amqp==5.3.1 attrs==24.2.0 -bcrypt==4.2.0 +autopage==0.5.2 +barbican==18.0.0 +bcrypt==4.2.1 cachetools==5.5.0 +castellan==5.2.0 certifi==2024.8.30 -charset-normalizer==3.3.2 +cffi==1.17.1 +charset-normalizer==3.4.0 click==8.1.7 +cliff==4.8.0 +cmd2==2.5.8 +cryptography==42.0.8 debtcollector==3.0.0 decorator==5.1.1 -deepdiff==8.0.1 +deepdiff==8.1.1 +dnspython==2.7.0 dogpile.cache==1.3.3 -falcon==3.1.3 +eventlet==0.38.1 +falcon==4.0.2 +fasteners==0.19 +futurist==3.0.0 gitdb==4.0.11 GitPython==3.1.43 -google-auth==2.34.0 -greenlet==3.1.0 +google-auth==2.36.0 +greenlet==3.1.1 idna==3.10 iso8601==2.1.0 Jinja2==3.1.4 jsonschema==4.23.0 jsonschema-specifications==2023.12.1 -keystoneauth1==5.1.2 -keystonemiddleware==10.2.0 +keystoneauth1==5.6.0 +keystonemiddleware==10.6.0 +kombu==5.4.2 kubernetes==30.1.0 -Mako==1.3.5 -MarkupSafe==2.1.5 +ldap3==2.9.1 +logutils==0.3.5 +Mako==1.3.8 +MarkupSafe==3.0.2 +microversion-parse==2.0.0 mock==5.1.0 msgpack==1.1.0 netaddr==1.3.0 netifaces==0.11.0 oauthlib==3.2.2 -orderly-set==5.2.2 +orderly-set==5.2.3 os-service-types==1.7.0 -oslo.cache==3.3.1 -oslo.config==9.1.1 -oslo.context==5.1.1 -oslo.db==12.3.1 -oslo.i18n==6.0.0 -oslo.log==5.2.0 -oslo.middleware==5.1.1 -oslo.policy==4.1.1 -oslo.serialization==5.1.1 -oslo.utils==6.1.0 -packaging==24.1 +oslo.cache==3.7.0 +oslo.concurrency==6.0.0 +oslo.config==9.4.0 +oslo.context==5.5.0 +oslo.db==15.0.0 +oslo.i18n==6.3.0 +oslo.log==5.5.1 +oslo.messaging==14.7.2 +oslo.metrics==0.8.0 +oslo.middleware==6.1.0 +oslo.policy==4.3.0 +oslo.serialization==5.4.1 +oslo.service==3.4.1 +oslo.upgradecheck==2.3.0 +oslo.utils==7.1.0 +oslo.versionedobjects==3.3.0 +packaging==24.2 Paste==3.10.1 PasteDeploy==3.1.0 pbr==6.1.0 +pecan==1.5.1 pip==24.1 -prometheus_client==0.20.0 +prettytable==3.12.0 +prometheus_client==0.21.1 py==1.11.0 pyasn1==0.6.1 pyasn1_modules==0.4.0 -pycadf==3.1.1 +pycadf==4.0.0 +pycparser==2.22 +PyJWT==2.10.1 pylibyaml==0.1.0 -pyparsing==3.1.4 +pyOpenSSL==24.3.0 +pyparsing==3.2.0 +pyperclip==1.9.0 +python-barbicanclient==5.7.0 python-dateutil==2.9.0.post0 -python-keystoneclient==5.1.0 +python-keystoneclient==5.4.0 python-memcached==1.62 pytz==2024.2 PyYAML==6.0.2 referencing==0.35.1 +repoze.lru==0.7 requests==2.32.3 requests-oauthlib==1.3.1 responses==0.25.3 retry==0.9.2 rfc3986==2.0.0 -rpds-py==0.20.0 +Routes==2.5.1 +rpds-py==0.22.3 rsa==4.9 setuptools==70.1.0 -six==1.16.0 +six==1.17.0 smmap==5.0.1 SQLAlchemy==1.4.54 -sqlalchemy-migrate==0.13.0 -sqlparse==0.5.1 statsd==4.0.1 -stevedore==5.3.0 -Tempita==0.5.2 +stevedore==5.4.0 testresources==2.0.1 testscenarios==0.5.0 testtools==2.7.2 typing_extensions==4.12.2 -urllib3==2.2.2 -uWSGI==2.0.27 -WebOb==1.8.8 +tzdata==2024.2 +urllib3==2.2.3 +uWSGI==2.0.28 +vine==5.1.0 +wcwidth==0.2.13 +WebOb==1.8.9 websocket-client==1.8.0 wheel==0.43.0 -wrapt==1.16.0 +wrapt==1.17.0 +yappi==1.6.10 diff --git a/setup.cfg b/setup.cfg index 1060f341..dfecd2e6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,6 +54,7 @@ with-doctest=1 [yapf] based_on_style = pep8 +column_limit = 79 blank_line_before_nested_class_or_def = true blank_line_before_module_docstring = true split_before_logical_operator = false diff --git a/setup.py b/setup.py index 49d30720..e5604caa 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,7 @@ try: except ImportError: pass -setuptools.setup( - package_data={'armada': ['schemas/*.yaml']}, - include_package_data=True, - setup_requires=['pbr>=2.0.0'], - pbr=True) +setuptools.setup(package_data={'armada': ['schemas/*.yaml']}, + include_package_data=True, + setup_requires=['pbr>=2.0.0'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index bdb15e0f..36261638 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,11 +1,12 @@ bandit==1.6.0 # cmd2>=1.5.0 coverage==5.3 -flake8-import-order>=0.18.1 -flake8==3.8.4 +flake8-import-order +importlib-metadata +flake8 >= 6.0.0 grpcio-tools>=1.16.0 os-testr>=1.0.0 # Apache-2.0 -pyflakes==2.2.0 +pyflakes sphinx-rtd-theme==0.5.0 stestr==4.1.0 testrepository==0.0.20 @@ -14,4 +15,5 @@ testscenarios==0.5.0 # testtools==2.5.0 # tox>=3.28.0, <4.0.0 # typing-extensions>=3.7.2 -yapf==0.27.0 +yapf + diff --git a/tox.ini b/tox.ini index 997a949a..df9223d2 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ allowlist_externals= sh deps= -r{toxinidir}/requirements-direct.txt - -c https://raw.githubusercontent.com/apache/airflow/constraints-2.10.2/constraints-3.10.txt + -c https://raw.githubusercontent.com/apache/airflow/constraints-2.10.4/constraints-3.10.txt commands= rm -f requirements-frozen.txt sh -c "pip freeze --all | grep -vE 'armada|pyinotify|pkg-resources==0.0.0' > requirements-frozen.txt" @@ -118,5 +118,6 @@ enable-extensions = H106,H201,H904 ignore = W503,B202,B113 exclude = .git,.tox,dist,*lib/python*,*egg,build,releasenotes,doc/*,venv max-complexity = 24 +max-line-length = 79 application-import-names = armada import-order-style = pep8