Add flake8 check and flake8-import-order

Improving the code quality of the plugins by adding the flake8 check on
zuul and addint the flake8-import-order plugin to standardize imports.
Also, defaults testenv to python3.9 configuration that should be used
for now on with the debian migration.

Story: 2010100
Task: 45656
Signed-off-by: Thiago Brito <thiago.brito@windriver.com>
Change-Id: I6566d5b99f4e7b19feeffe3b35674222eabe1cca
This commit is contained in:
Thiago Brito 2022-06-21 12:15:22 -03:00
parent b5b4cc562a
commit dceba41943
50 changed files with 179 additions and 167 deletions

@ -7,6 +7,7 @@
- k8sapp-openstack-tox-py36 - k8sapp-openstack-tox-py36
- k8sapp-openstack-tox-py39 - k8sapp-openstack-tox-py39
- k8sapp-openstack-tox-pylint - k8sapp-openstack-tox-pylint
- k8sapp-openstack-tox-pep8
gate: gate:
jobs: jobs:
- openstack-tox-linters - openstack-tox-linters
@ -98,6 +99,23 @@
tox_envlist: pylint tox_envlist: pylint
tox_extra_args: -c python-k8sapp-openstack/k8sapp_openstack/tox.ini tox_extra_args: -c python-k8sapp-openstack/k8sapp_openstack/tox.ini
- job:
name: k8sapp-openstack-tox-pep8
parent: tox
description: |
Run pep8 tests for k8sapp_openstack
nodeset: ubuntu-bionic
required-projects:
- starlingx/config
- starlingx/fault
- starlingx/update
- starlingx/utilities
files:
- python-k8sapp-openstack/*
vars:
tox_envlist: pep8
tox_extra_args: -c python-k8sapp-openstack/k8sapp_openstack/tox.ini
- secret: - secret:
name: stx-openstack-armada-app-github-secret name: stx-openstack-armada-app-github-secret
data: data:

@ -1,4 +1,3 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# #
# Copyright (c) 2019-2021 Wind River Systems, Inc. # Copyright (c) 2019-2021 Wind River Systems, Inc.
# #
@ -9,11 +8,15 @@
""" System inventory Armada manifest operator.""" """ System inventory Armada manifest operator."""
# fmt:off
import os
from copy import deepcopy from copy import deepcopy
import os
from oslo_log import log as logging
import ruamel.yaml as yaml import ruamel.yaml as yaml
from sysinv.common import constants
from sysinv.common import exception
from sysinv.helm import manifest_base as base
from k8sapp_openstack.common import constants as app_constants from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm.aodh import AodhHelm from k8sapp_openstack.helm.aodh import AodhHelm
from k8sapp_openstack.helm.barbican import BarbicanHelm from k8sapp_openstack.helm.barbican import BarbicanHelm
@ -39,17 +42,12 @@ from k8sapp_openstack.helm.nginx_ports_control import NginxPortsControlHelm
from k8sapp_openstack.helm.nova import NovaHelm from k8sapp_openstack.helm.nova import NovaHelm
from k8sapp_openstack.helm.nova_api_proxy import NovaApiProxyHelm from k8sapp_openstack.helm.nova_api_proxy import NovaApiProxyHelm
from k8sapp_openstack.helm.openvswitch import OpenvswitchHelm from k8sapp_openstack.helm.openvswitch import OpenvswitchHelm
from k8sapp_openstack.helm.pci_irq_affinity_agent import \ from k8sapp_openstack.helm.pci_irq_affinity_agent import PciIrqAffinityAgentHelm
PciIrqAffinityAgentHelm
from k8sapp_openstack.helm.placement import PlacementHelm from k8sapp_openstack.helm.placement import PlacementHelm
from k8sapp_openstack.helm.psp_rolebinding import PSPRolebindingHelm from k8sapp_openstack.helm.psp_rolebinding import PSPRolebindingHelm
from k8sapp_openstack.helm.rabbitmq import RabbitmqHelm from k8sapp_openstack.helm.rabbitmq import RabbitmqHelm
from k8sapp_openstack.helm.swift import SwiftHelm from k8sapp_openstack.helm.swift import SwiftHelm
from oslo_log import log as logging
from sysinv.common import constants, exception
from sysinv.helm import manifest_base as base
# fmt:on
KEY_SCHEMA = "schema" KEY_SCHEMA = "schema"
VAL_SCHEMA_CHART_GROUP = "armada/ChartGroup/v" VAL_SCHEMA_CHART_GROUP = "armada/ChartGroup/v"

@ -4,12 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class AodhHelm(openstack.OpenstackBaseHelm): class AodhHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the aodh chart""" """Class to encapsulate helm operations for the aodh chart"""

@ -4,12 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class BarbicanHelm(openstack.OpenstackBaseHelm): class BarbicanHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the barbican chart""" """Class to encapsulate helm operations for the barbican chart"""
@ -84,4 +84,3 @@ class BarbicanHelm(openstack.OpenstackBaseHelm):
}, },
} }
} }

@ -4,13 +4,13 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.common import utils from sysinv.common import utils
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class CeilometerHelm(openstack.OpenstackBaseHelm): class CeilometerHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the ceilometer chart""" """Class to encapsulate helm operations for the ceilometer chart"""

@ -4,15 +4,15 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
import tsconfig.tsconfig as tsc
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.common import utils
from sysinv.common import storage_backend_conf from sysinv.common import storage_backend_conf
from sysinv.common import utils
from sysinv.helm import common from sysinv.helm import common
from tsconfig import tsconfig as tsc
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
ROOK_CEPH_BACKEND_NAME = 'ceph-store' ROOK_CEPH_BACKEND_NAME = 'ceph-store'
@ -179,7 +179,6 @@ class CinderHelm(openstack.OpenstackBaseHelm):
'cafile': self.get_ca_file() 'cafile': self.get_ca_file()
} }
return conf_cinder return conf_cinder
def _get_conf_backends_overrides(self): def _get_conf_backends_overrides(self):

@ -4,13 +4,13 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class DcdbsyncHelm(openstack.OpenstackBaseHelm): class DcdbsyncHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the dcdbsync chart""" """Class to encapsulate helm operations for the dcdbsync chart"""

@ -3,11 +3,12 @@
# #
from oslo_log import log as logging from oslo_log import log as logging
from sysinv.common import exception
from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack from k8sapp_openstack.helm import openstack
from sysinv.common import exception
from sysinv.helm import common
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

@ -4,16 +4,16 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.common import utils from sysinv.common import utils
from sysinv.common.storage_backend_conf import StorageBackendConfig from sysinv.common.storage_backend_conf import StorageBackendConfig
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
# Info used in the Glance Helm chart. # Info used in the Glance Helm chart.
RBD_STORE_USER = 'images' RBD_STORE_USER = 'images'

@ -4,12 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class GnocchiHelm(openstack.OpenstackBaseHelm): class GnocchiHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the gnocchi chart""" """Class to encapsulate helm operations for the gnocchi chart"""

@ -4,12 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class HeatHelm(openstack.OpenstackBaseHelm): class HeatHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the heat chart""" """Class to encapsulate helm operations for the heat chart"""

@ -4,10 +4,11 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common
from sysinv.helm import base from sysinv.helm import base
from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
class HelmToolkitHelm(base.BaseHelm): class HelmToolkitHelm(base.BaseHelm):

@ -4,13 +4,13 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class HorizonHelm(openstack.OpenstackBaseHelm): class HorizonHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the horizon chart""" """Class to encapsulate helm operations for the horizon chart"""

@ -4,14 +4,13 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class IronicHelm(openstack.OpenstackBaseHelm): class IronicHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the ironic chart""" """Class to encapsulate helm operations for the ironic chart"""

@ -4,15 +4,15 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from six.moves import configparser
import os import os
from six.moves import configparser
from sysinv.common import exception
from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack from k8sapp_openstack.helm import openstack
from sysinv.common import exception
from sysinv.helm import common
OPENSTACK_PASSWORD_RULES_FILE = '/etc/keystone/password-rules.conf' OPENSTACK_PASSWORD_RULES_FILE = '/etc/keystone/password-rules.conf'

@ -4,12 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class LibvirtHelm(openstack.OpenstackBaseHelm): class LibvirtHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the libvirt chart""" """Class to encapsulate helm operations for the libvirt chart"""

@ -4,13 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from sysinv.common import exception
from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack from k8sapp_openstack.helm import openstack
from sysinv.common import exception
from sysinv.helm import common
class MagnumHelm(openstack.OpenstackBaseHelm): class MagnumHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the magnum chart""" """Class to encapsulate helm operations for the magnum chart"""

@ -4,13 +4,13 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from sysinv.common import exception
from sysinv.common import utils as cutils
from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack from k8sapp_openstack.helm import openstack
from sysinv.common import utils as cutils
from sysinv.common import exception
from sysinv.helm import common
class MariadbHelm(openstack.OpenstackBaseHelm): class MariadbHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the mariadb chart""" """Class to encapsulate helm operations for the mariadb chart"""

@ -5,14 +5,14 @@
# #
from oslo_log import log as logging from oslo_log import log as logging
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.common import utils from sysinv.common import utils
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
DATA_NETWORK_TYPES = [constants.NETWORK_TYPE_DATA] DATA_NETWORK_TYPES = [constants.NETWORK_TYPE_DATA]

@ -5,10 +5,11 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common
from sysinv.helm import base from sysinv.helm import base
from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
class NginxPortsControlHelm(base.BaseHelm): class NginxPortsControlHelm(base.BaseHelm):

@ -9,9 +9,6 @@ import copy
import os import os
from oslo_log import log as logging from oslo_log import log as logging
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.common import interface from sysinv.common import interface
@ -19,6 +16,9 @@ from sysinv.common import utils
from sysinv.common.storage_backend_conf import StorageBackendConfig from sysinv.common.storage_backend_conf import StorageBackendConfig
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
# Align ephemeral rbd_user with the cinder rbd_user so that the same libvirt # Align ephemeral rbd_user with the cinder rbd_user so that the same libvirt

@ -4,12 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class NovaApiProxyHelm(openstack.OpenstackBaseHelm): class NovaApiProxyHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the nova chart""" """Class to encapsulate helm operations for the nova chart"""

@ -4,9 +4,7 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from eventlet.green import subprocess
import base64 import base64
import keyring
import os import os
# Adding a try-import as six 1.12.0 doesn't have this move and we are pinned # Adding a try-import as six 1.12.0 doesn't have this move and we are pinned
# at the stein upper-requirements on tox.ini # at the stein upper-requirements on tox.ini
@ -18,6 +16,8 @@ except ImportError: # Python 2.7-3.2
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives.asymmetric import rsa
from eventlet.green import subprocess
import keyring
from oslo_log import log from oslo_log import log
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm.exc import NoResultFound
@ -29,8 +29,8 @@ from sysinv.common.storage_backend_conf import K8RbdProvisioner
from sysinv.helm import base from sysinv.helm import base
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack import utils as app_utils from k8sapp_openstack import utils as app_utils
from k8sapp_openstack.common import constants as app_constants
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -263,7 +263,6 @@ class OpenstackBaseHelm(BaseHelm):
} }
}) })
return overrides return overrides
def _get_file_content(self, filename): def _get_file_content(self, filename):

@ -4,14 +4,14 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.common import utils from sysinv.common import utils
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class OpenvswitchHelm(openstack.OpenstackBaseHelm): class OpenvswitchHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the openvswitch chart""" """Class to encapsulate helm operations for the openvswitch chart"""

@ -5,12 +5,12 @@
# #
from oslo_log import log as logging from oslo_log import log as logging
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -49,10 +49,10 @@ class PciIrqAffinityAgentHelm(openstack.OpenstackBaseHelm):
overrides = { overrides = {
'identity': { 'identity': {
'auth': self._get_endpoints_identity_overrides( 'auth': self._get_endpoints_identity_overrides(
self.SERVICE_NAME, self.SERVICE_NAME,
self.AUTH_USERS self.AUTH_USERS
), ),
}, },
'rabbit': { 'rabbit': {
'rabbit_userid': nova_oslo_messaging_data['username'], 'rabbit_userid': nova_oslo_messaging_data['username'],

@ -5,12 +5,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class PlacementHelm(openstack.OpenstackBaseHelm): class PlacementHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the placement chart""" """Class to encapsulate helm operations for the placement chart"""

@ -4,12 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class RabbitmqHelm(openstack.OpenstackBaseHelm): class RabbitmqHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the rabbitmq chart""" """Class to encapsulate helm operations for the rabbitmq chart"""

@ -4,12 +4,12 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
from sysinv.common import exception from sysinv.common import exception
from sysinv.helm import common from sysinv.helm import common
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import openstack
class SwiftHelm(openstack.OpenstackBaseHelm): class SwiftHelm(openstack.OpenstackBaseHelm):
"""Class to encapsulate helm operations for the swift chart""" """Class to encapsulate helm operations for the swift chart"""

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common
@ -39,7 +39,7 @@ class AodhGetOverrideTest(AodhHelmTestCase,
}, },
}, },
}, },
'conf': {}, 'conf': {},
}) })
@mock.patch('os.path.exists', return_value=True) @mock.patch('os.path.exists', return_value=True)

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common
@ -40,9 +40,9 @@ class GlanceGetOverrideTest(GlanceHelmTestCase,
}, },
}, },
'storage': {}, 'storage': {},
'conf': {}, 'conf': {},
'bootstrap': {}, 'bootstrap': {},
'ceph_client': {}, 'ceph_client': {},
}) })
@mock.patch('os.path.exists', return_value=True) @mock.patch('os.path.exists', return_value=True)

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -3,17 +3,13 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
from oslo_utils import uuidutils
from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common
from sysinv.tests.db import base as dbbase from sysinv.tests.db import base as dbbase
from sysinv.tests.db import utils as dbutils from sysinv.tests.db import utils as dbutils
from sysinv.tests.helm import base from sysinv.tests.helm import base
from k8sapp_openstack.common import constants as app_constants from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.helm import neutron
from k8sapp_openstack.tests import test_plugins from k8sapp_openstack.tests import test_plugins
@ -50,7 +46,7 @@ class IronicGetOverrideTest(IronicHelmTestCase,
app_constants.HELM_CHART_IRONIC, app_constants.HELM_CHART_IRONIC,
cnamespace=common.HELM_NS_OPENSTACK) cnamespace=common.HELM_NS_OPENSTACK)
self.assertEquals( self.assertEqual(
overrides_ironic["endpoints"]["identity"]["auth"]["glance"], overrides_ironic["endpoints"]["identity"]["auth"]["glance"],
overrides_glance["endpoints"]["identity"]["auth"]["glance"], overrides_glance["endpoints"]["identity"]["auth"]["glance"],
) )

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common
@ -39,8 +39,8 @@ class KeystoneGetOverrideTest(KeystoneHelmTestCase,
}, },
}, },
}, },
'conf': {}, 'conf': {},
'network': {}, 'network': {},
}) })
@mock.patch('os.path.exists', return_value=True) @mock.patch('os.path.exists', return_value=True)

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common
@ -50,7 +50,7 @@ class NeutronGetOverrideTest(NeutronHelmTestCase,
app_constants.HELM_CHART_NEUTRON, app_constants.HELM_CHART_NEUTRON,
cnamespace=common.HELM_NS_OPENSTACK) cnamespace=common.HELM_NS_OPENSTACK)
self.assertEquals( self.assertEqual(
overrides_nova["endpoints"]["identity"]["auth"]["nova"], overrides_nova["endpoints"]["identity"]["auth"]["nova"],
overrides_neutron["endpoints"]["identity"]["auth"]["nova"], overrides_neutron["endpoints"]["identity"]["auth"]["nova"],
) )

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common
@ -83,15 +83,15 @@ class NovaGetOverrideTest(NovaHelmTestCase,
app_constants.HELM_CHART_NOVA, app_constants.HELM_CHART_NOVA,
cnamespace=common.HELM_NS_OPENSTACK) cnamespace=common.HELM_NS_OPENSTACK)
self.assertEquals( self.assertEqual(
overrides_nova["endpoints"]["identity"]["auth"]["neutron"], overrides_nova["endpoints"]["identity"]["auth"]["neutron"],
overrides_neutron["endpoints"]["identity"]["auth"]["neutron"], overrides_neutron["endpoints"]["identity"]["auth"]["neutron"],
) )
self.assertEquals( self.assertEqual(
overrides_nova["endpoints"]["identity"]["auth"]["ironic"], overrides_nova["endpoints"]["identity"]["auth"]["ironic"],
overrides_ironic["endpoints"]["identity"]["auth"]["ironic"], overrides_ironic["endpoints"]["identity"]["auth"]["ironic"],
) )
self.assertEquals( self.assertEqual(
overrides_nova["endpoints"]["identity"]["auth"]["placement"], overrides_nova["endpoints"]["identity"]["auth"]["placement"],
overrides_placement["endpoints"]["identity"]["auth"]["placement"], overrides_placement["endpoints"]["identity"]["auth"]["placement"],
) )

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common
@ -53,11 +53,11 @@ class NovaApiProxyGetOverrideTest(NovaApiProxyHelmTestCase,
app_constants.HELM_CHART_NOVA_API_PROXY, app_constants.HELM_CHART_NOVA_API_PROXY,
cnamespace=common.HELM_NS_OPENSTACK) cnamespace=common.HELM_NS_OPENSTACK)
self.assertEquals( self.assertEqual(
overrides_n_api_prx["endpoints"]["identity"]["auth"]["neutron"], overrides_n_api_prx["endpoints"]["identity"]["auth"]["neutron"],
overrides_neutron["endpoints"]["identity"]["auth"]["neutron"], overrides_neutron["endpoints"]["identity"]["auth"]["neutron"],
) )
self.assertEquals( self.assertEqual(
overrides_n_api_prx["endpoints"]["identity"]["auth"]["placement"], overrides_n_api_prx["endpoints"]["identity"]["auth"]["placement"],
overrides_placement["endpoints"]["identity"]["auth"]["placement"], overrides_placement["endpoints"]["identity"]["auth"]["placement"],
) )

@ -3,8 +3,8 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import mock
import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common

@ -5,11 +5,10 @@
# #
import mock import mock
from sysinv.tests.db import base as dbbase
from k8sapp_openstack.lifecycle import lifecycle_openstack from k8sapp_openstack.lifecycle import lifecycle_openstack
from sysinv.tests.db import base as dbbase
class OpenstackAppLifecycleOperatorTest(dbbase.ControllerHostTestCase): class OpenstackAppLifecycleOperatorTest(dbbase.ControllerHostTestCase):
def setUp(self): def setUp(self):

@ -4,14 +4,14 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.tests import test_plugins
from sysinv.helm import common from sysinv.helm import common
from sysinv.tests.db import base as dbbase from sysinv.tests.db import base as dbbase
from sysinv.tests.db import utils as dbutils from sysinv.tests.db import utils as dbutils
from sysinv.tests.helm import base from sysinv.tests.helm import base
from k8sapp_openstack.common import constants as app_constants
from k8sapp_openstack.tests import test_plugins
class NovaApiProxyTestCase(test_plugins.K8SAppOpenstackAppMixin, class NovaApiProxyTestCase(test_plugins.K8SAppOpenstackAppMixin,
base.HelmTestCaseMixin): base.HelmTestCaseMixin):
@ -38,7 +38,6 @@ class NovaApiProxyIPv4ControllerHostTestCase(NovaApiProxyTestCase,
class NovaApiProxyIPv4AIODuplexSystemTestCase(NovaApiProxyTestCase, class NovaApiProxyIPv4AIODuplexSystemTestCase(NovaApiProxyTestCase,
dbbase.ProvisionedAIODuplexSystemTestCase): dbbase.ProvisionedAIODuplexSystemTestCase):
def test_replicas(self): def test_replicas(self):
overrides = self.operator.get_helm_chart_overrides( overrides = self.operator.get_helm_chart_overrides(
app_constants.HELM_CHART_NOVA_API_PROXY, app_constants.HELM_CHART_NOVA_API_PROXY,

@ -2,12 +2,7 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
# fmt:off
import mock import mock
from k8sapp_openstack.armada.manifest_openstack import \
OpenstackArmadaManifestOperator
from k8sapp_openstack.common import constants as app_constants
from sysinv.common import constants from sysinv.common import constants
from sysinv.helm import common from sysinv.helm import common
from sysinv.tests.db import base as dbbase from sysinv.tests.db import base as dbbase
@ -15,7 +10,9 @@ from sysinv.tests.db import utils as dbutils
from sysinv.tests.helm import base from sysinv.tests.helm import base
from sysinv.tests.helm.test_helm import HelmOperatorTestSuiteMixin from sysinv.tests.helm.test_helm import HelmOperatorTestSuiteMixin
# fmt:on from k8sapp_openstack.armada.manifest_openstack import OpenstackArmadaManifestOperator
from k8sapp_openstack.common import constants as app_constants
KEY_SCHEMA = "schema" KEY_SCHEMA = "schema"
KEY_METADATA = "metadata" KEY_METADATA = "metadata"

@ -5,11 +5,8 @@
# #
import mock import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.tests.db import base as dbbase from sysinv.tests.db import base as dbbase
from k8sapp_openstack import utils as app_utils from k8sapp_openstack import utils as app_utils

@ -1,5 +1,5 @@
[tox] [tox]
envlist = flake8,py27,py36,py39,pylint envlist = pep8,py27,py36,py39,pylint
minversion = 1.6 minversion = 1.6
# skipsdist = True # skipsdist = True
#,pip-missing-reqs #,pip-missing-reqs
@ -10,6 +10,7 @@ stxdir = {toxinidir}/../../..
distshare={toxworkdir}/.tox/distshare distshare={toxworkdir}/.tox/distshare
[testenv] [testenv]
basepython = python3.9
# usedevelop = True # usedevelop = True
# enabling usedevelop results in py27 develop-inst: # enabling usedevelop results in py27 develop-inst:
# Exception: Versioning for this project requires either an sdist tarball, # Exception: Versioning for this project requires either an sdist tarball,
@ -21,10 +22,8 @@ sitepackages = False
whitelist_externals = bash whitelist_externals = bash
find find
install_command = pip install \ install_command = pip install -v -v -v \
-v -v -v \ -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
{opts} {packages} {opts} {packages}
# Note the hash seed is set to 0 until can be tested with a # Note the hash seed is set to 0 until can be tested with a
@ -97,16 +96,28 @@ ignore = H101,H102,H104,H105,H306,H401,H403,H404,H405,H701,H702,H703,
E117,E126,E127,E128,E402 E117,E126,E127,E128,E402
exclude = build,dist,tools,.eggs exclude = build,dist,tools,.eggs
max-line-length=120 max-line-length=120
import-order-style = google
application-import-names = k8sapp_openstack
[testenv:flake8] [testenv:pep8]
basepython = python3 basepython = python3.6
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
flake8-bugbear flake8-bugbear
flake8-import-order
install_command = pip install -v -v -v \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
{opts} {packages}
commands = commands =
flake8 {posargs} . flake8 {posargs} .
[testenv:py27] [testenv:py27]
basepython = python2.7 basepython = python2.7
install_command = pip install \
-v -v -v \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
{opts} {packages}
commands = commands =
{[testenv]commands} {[testenv]commands}
stestr run {posargs} stestr run {posargs}
@ -114,26 +125,21 @@ commands =
[testenv:py36] [testenv:py36]
basepython = python3.6 basepython = python3.6
commands = install_command = pip install \
{[testenv]commands} -v -v -v \
stestr run {posargs} -c{toxinidir}/upper-constraints.txt \
stestr slowest -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
[testenv:py39]
basepython = python3.9
install_command = pip install -v -v -v \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages} {opts} {packages}
commands = commands =
{[testenv]commands} {[testenv]commands}
stestr run {posargs} stestr run {posargs}
stestr slowest stestr slowest
[testenv:pep8] [testenv:py39]
# testenv:flake8 clone commands =
basepython = {[testenv:flake8]basepython} {[testenv]commands}
deps = {[testenv:flake8]deps} stestr run {posargs}
commands = {[testenv:flake8]commands} stestr slowest
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}
@ -179,9 +185,13 @@ commands = bandit --ini tox.ini -n 5 -r k8sapp_openstack
[testenv:pylint] [testenv:pylint]
basepython = python2.7 basepython = python2.7
sitepackages = False sitepackages = False
deps = {[testenv]deps} deps = {[testenv]deps}
pylint pylint
install_command = pip install \
-v -v -v \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
{opts} {packages}
commands = commands =
pylint {posargs} k8sapp_openstack --rcfile=./pylint.rc pylint {posargs} k8sapp_openstack --rcfile=./pylint.rc

@ -1,4 +1,4 @@
# Override upstream constraints based on StarlingX load # Override upstream constraints based on StarlingX CentOS load, do not use for Debian
iso8601==0.1.12 iso8601==0.1.12
openstacksdk==0.27.1 openstacksdk==0.27.1
os-client-config==1.32.0 os-client-config==1.32.0