From 8a5d90815f0ec36c842257564b8487a8b274b457 Mon Sep 17 00:00:00 2001 From: Bart Wensley Date: Fri, 22 Jan 2021 14:32:18 -0600 Subject: [PATCH] Fix zuul gates for f/centos8 This commit fixes various gate issues on f/centos8, this is being done so we can merge the master branch into the f/centos8 due to an issue with merging branches and zuul. The fixes have been cherry-picked from the master branch: - "Turn off the legacy pip resolver for distcloud" Fix requirements that needed to be updated, also fix bugbear. (527a48513a2534ed73755f758e01992414cabe21) - "Specify the nodeset for zuul jobs" py2.7 jobs need to specify xenial, py3.6 needs to specify bionic. (9f5b85c41c2d8aec2e550f187a8b40a7525033b0) - " Remove entries related to host-based snmp" SNMP has been removed in the sysinv repo as a result the distcloud repo is out of sync. This is a temporary workaround until the master branch has been merged. (ec8dba8a53b1beb0562bdd4228860f42e8d055e2) Signed-off-by: Charles Short Change-Id: Ife92f0639b4b56aa3a16369613388c33834bca97 --- .zuul.yaml | 4 + .../dccommon/drivers/openstack/sysinv_v1.py | 136 ------------ distributedcloud/dccommon/exceptions.py | 14 -- distributedcloud/dcdbsync/common/messaging.py | 8 +- .../dcorch/api/proxy/apps/controller.py | 13 +- .../dcorch/api/proxy/common/constants.py | 14 -- distributedcloud/dcorch/common/consts.py | 2 - .../dcorch/engine/sync_services/sysinv.py | 205 +----------------- distributedcloud/requirements.txt | 2 +- distributedcloud/test-requirements.txt | 2 +- distributedcloud/tox.ini | 16 +- distributedcloud/upper-constraints.txt | 5 - doc/requirements.txt | 6 +- tox.ini | 2 +- 14 files changed, 20 insertions(+), 409 deletions(-) delete mode 100644 distributedcloud/upper-constraints.txt diff --git a/.zuul.yaml b/.zuul.yaml index 767c891b8..4c8eeecdb 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -25,6 +25,7 @@ - job: name: stx-distcloud-tox-py27 parent: tox + nodeset: ubuntu-xenial description: Run py27 for distcloud required-projects: - starlingx/fault @@ -37,6 +38,7 @@ - job: name: stx-distcloud-tox-py36 + nodeset: ubuntu-bionic parent: tox description: Run py36 for distcloud required-projects: @@ -50,6 +52,7 @@ - job: name: stx-distcloud-tox-pylint + nodeset: ubuntu-bionic parent: tox description: Run pylint for distcloud required-projects: @@ -63,6 +66,7 @@ - job: name: stx-distcloud-tox-pep8 + nodeset: ubuntu-bionic parent: tox description: Run pep8 for distcloud required-projects: diff --git a/distributedcloud/dccommon/drivers/openstack/sysinv_v1.py b/distributedcloud/dccommon/drivers/openstack/sysinv_v1.py index 45d7d9440..8f82b8243 100644 --- a/distributedcloud/dccommon/drivers/openstack/sysinv_v1.py +++ b/distributedcloud/dccommon/drivers/openstack/sysinv_v1.py @@ -21,12 +21,7 @@ import hashlib -from cgtsclient.exc import HTTPConflict from cgtsclient.exc import HTTPNotFound -from cgtsclient.v1.icommunity import CREATION_ATTRIBUTES \ - as SNMP_COMMUNITY_CREATION_ATTRIBUTES -from cgtsclient.v1.itrapdest import CREATION_ATTRIBUTES \ - as SNMP_TRAPDEST_CREATION_ATTRIBUTES from oslo_log import log from sysinv.common import constants as sysinv_constants @@ -238,137 +233,6 @@ class SysinvClient(base.DriverBase): return idns - def snmp_trapdest_list(self): - """Get the trapdest list for this region - - :return: itrapdests list of itrapdest - """ - itrapdests = self.sysinv_client.itrapdest.list() - return itrapdests - - def snmp_trapdest_create(self, trapdest_dict): - """Add the trapdest for this region - - :param: trapdest_payload dictionary - :return: itrapdest - """ - - # Example trapdest_dict: - # {"ip_address": "10.10.10.12", "community": "cgcs"} - itrapdest = None - trapdest_create_dict = {} - for k, v in trapdest_dict.items(): - if k in SNMP_TRAPDEST_CREATION_ATTRIBUTES: - trapdest_create_dict[str(k)] = v - - LOG.info("snmp_trapdest_create driver region={}" - "trapdest_create_dict={}".format( - self.region_name, trapdest_create_dict)) - try: - itrapdest = self.sysinv_client.itrapdest.create( - **trapdest_create_dict) - except HTTPConflict: - LOG.info("snmp_trapdest_create exists region={}" - "trapdest_dict={}".format( - self.region_name, trapdest_dict)) - # Retrieve the existing itrapdest - trapdests = self.snmp_trapdest_list() - for trapdest in trapdests: - if trapdest.ip_address == trapdest_dict.get('ip_address'): - LOG.info("snmp_trapdest_create found existing {}" - "for region: {}".format( - trapdest, self.region_name)) - itrapdest = trapdest - break - except Exception as e: - LOG.error("snmp_trapdest_create exception={}".format(e)) - raise e - - return itrapdest - - def snmp_trapdest_delete(self, trapdest_ip_address): - """Delete the trapdest for this region - - :param: trapdest_ip_address - """ - try: - LOG.info("snmp_trapdest_delete region {} ip_address: {}".format( - self.region_name, trapdest_ip_address)) - self.sysinv_client.itrapdest.delete(trapdest_ip_address) - except HTTPNotFound: - LOG.info("snmp_trapdest_delete NotFound {} for region: {}".format( - trapdest_ip_address, self.region_name)) - raise exceptions.TrapDestNotFound(region_name=self.region_name, - ip_address=trapdest_ip_address) - except Exception as e: - LOG.error("snmp_trapdest_delete exception={}".format(e)) - raise e - - def snmp_community_list(self): - """Get the community list for this region - - :return: icommunitys list of icommunity - """ - icommunitys = self.sysinv_client.icommunity.list() - return icommunitys - - def snmp_community_create(self, community_dict): - """Add the community for this region - - :param: community_payload dictionary - :return: icommunity - """ - - # Example community_dict: {"community": "cgcs"} - icommunity = None - community_create_dict = {} - for k, v in community_dict.items(): - if k in SNMP_COMMUNITY_CREATION_ATTRIBUTES: - community_create_dict[str(k)] = v - - LOG.info("snmp_community_create driver region={}" - "community_create_dict={}".format( - self.region_name, community_create_dict)) - try: - icommunity = self.sysinv_client.icommunity.create( - **community_create_dict) - except HTTPConflict: - LOG.info("snmp_community_create exists region={}" - "community_dict={}".format( - self.region_name, community_dict)) - # Retrieve the existing icommunity - communitys = self.snmp_community_list() - for community in communitys: - if community.community == community_dict.get('community'): - LOG.info("snmp_community_create found existing {}" - "for region: {}".format( - community, self.region_name)) - icommunity = community - break - except Exception as e: - LOG.error("snmp_community_create exception={}".format(e)) - raise e - - return icommunity - - def snmp_community_delete(self, community): - """Delete the community for this region - - :param: community - """ - try: - LOG.info("snmp_community_delete region {} community: {}".format( - self.region_name, community)) - self.sysinv_client.icommunity.delete(community) - except HTTPNotFound: - LOG.info("snmp_community_delete NotFound {} for region: {}".format( - community, self.region_name)) - raise exceptions.CommunityNotFound(region_name=self.region_name, - community=community) - except Exception as e: - LOG.error("snmp_community_delete exception={}".format(e)) - raise e - def get_certificates(self): """Get the certificates for this region diff --git a/distributedcloud/dccommon/exceptions.py b/distributedcloud/dccommon/exceptions.py index 631e1337a..b8558468e 100644 --- a/distributedcloud/dccommon/exceptions.py +++ b/distributedcloud/dccommon/exceptions.py @@ -81,20 +81,6 @@ class OAMAddressesNotFound(NotFound): message = _("OAM Addresses Not Found") -class TrapDestNotFound(NotFound): - message = _("Trapdest in region=%(region_name)s with ip_address " - "%(ip_address)s not found") - - -class CommunityAlreadyExists(Conflict): - message = _("Community %(community)s in region=%(region_name)s " - "already exists") - - -class CommunityNotFound(NotFound): - message = _("Community %(community)s not found in region=%(region_name)s") - - class CertificateNotFound(NotFound): message = _("Certificate in region=%(region_name)s with signature " "%(signature)s not found") diff --git a/distributedcloud/dcdbsync/common/messaging.py b/distributedcloud/dcdbsync/common/messaging.py index 7a2382863..bbf039a93 100644 --- a/distributedcloud/dcdbsync/common/messaging.py +++ b/distributedcloud/dcdbsync/common/messaging.py @@ -26,12 +26,6 @@ from dcdbsync.common import context TRANSPORT = None NOTIFIER = None -_ALIASES = { - 'dcdbsync.openstack.common.rpc.impl_kombu': 'rabbit', - 'dcdbsync.openstack.common.rpc.impl_qpid': 'qpid', - 'dcdbsync.openstack.common.rpc.impl_zmq': 'zmq', -} - class RequestContextSerializer(oslo_messaging.Serializer): def __init__(self, base): @@ -76,7 +70,7 @@ def setup(url=None, optional=False): exmods = ['dcdbsync.common.exception'] try: TRANSPORT = oslo_messaging.get_transport( - cfg.CONF, url, allowed_remote_exmods=exmods, aliases=_ALIASES) + cfg.CONF, url, allowed_remote_exmods=exmods) except oslo_messaging.InvalidTransportURL as e: TRANSPORT = None if not optional or e.url: diff --git a/distributedcloud/dcorch/api/proxy/apps/controller.py b/distributedcloud/dcorch/api/proxy/apps/controller.py index 7714fbed6..b9502f284 100644 --- a/distributedcloud/dcorch/api/proxy/apps/controller.py +++ b/distributedcloud/dcorch/api/proxy/apps/controller.py @@ -370,10 +370,6 @@ class ComputeAPIController(APIController): class SysinvAPIController(APIController): ENDPOINT_TYPE = consts.ENDPOINT_TYPE_PLATFORM - RESOURCE_ID_MAP = { - consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST: 'ip_address', - consts.RESOURCE_TYPE_SYSINV_SNMP_COMM: 'community' - } OK_STATUS_CODE = [ webob.exc.HTTPOk.code, webob.exc.HTTPNoContent.code @@ -414,14 +410,7 @@ class SysinvAPIController(APIController): else: resource_ids = [resource.get('signature')] else: - if (operation_type == consts.OPERATION_TYPE_POST and - resource_type in self.RESOURCE_ID_MAP): - # need to get the id from the request data since it is - # not available in the header - rid = self.RESOURCE_ID_MAP.get(resource_type) - resource_id = json.loads(request_body)[rid] - else: - resource_id = self.get_resource_id_from_link(request_header) + resource_id = self.get_resource_id_from_link(request_header) resource_ids = [resource_id] if operation_type != consts.OPERATION_TYPE_DELETE: resource_info['payload'] = json.loads(request_body) diff --git a/distributedcloud/dcorch/api/proxy/common/constants.py b/distributedcloud/dcorch/api/proxy/common/constants.py index 680d3e453..acf0a1f36 100755 --- a/distributedcloud/dcorch/api/proxy/common/constants.py +++ b/distributedcloud/dcorch/api/proxy/common/constants.py @@ -80,16 +80,6 @@ DNS_PATHS = [ '/v1/idns/{uuid}' ] -TRAP_DEST_PATHS = [ - '/v1/itrapdest', - '/v1/itrapdest/{ip}' -] - -COMMUNITY_STRING_PATHS = [ - '/v1/icommunity', - '/v1/icommunity/{community}' -] - CERTIFICATE_PATHS = [ '/v1/certificate/certificate_install', '/v1/certificate/{uuid}' @@ -102,8 +92,6 @@ USER_PATHS = [ SYSINV_PATH_MAP = { consts.RESOURCE_TYPE_SYSINV_DNS: DNS_PATHS, - consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST: TRAP_DEST_PATHS, - consts.RESOURCE_TYPE_SYSINV_SNMP_COMM: COMMUNITY_STRING_PATHS, consts.RESOURCE_TYPE_SYSINV_CERTIFICATE: CERTIFICATE_PATHS, consts.RESOURCE_TYPE_SYSINV_USER: USER_PATHS, } @@ -314,8 +302,6 @@ ROUTE_METHOD_MAP = { }, consts.ENDPOINT_TYPE_PLATFORM: { consts.RESOURCE_TYPE_SYSINV_DNS: ['PATCH', 'PUT'], - consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST: ['POST', 'DELETE'], - consts.RESOURCE_TYPE_SYSINV_SNMP_COMM: ['POST', 'DELETE'], consts.RESOURCE_TYPE_SYSINV_CERTIFICATE: ['POST', 'DELETE'], consts.RESOURCE_TYPE_SYSINV_USER: ['PATCH', 'PUT'], }, diff --git a/distributedcloud/dcorch/common/consts.py b/distributedcloud/dcorch/common/consts.py index 8b8096439..494ebc0b6 100644 --- a/distributedcloud/dcorch/common/consts.py +++ b/distributedcloud/dcorch/common/consts.py @@ -75,8 +75,6 @@ ORCH_REQUEST_ABORTED = "aborted" # SysInv Resources RESOURCE_TYPE_SYSINV_CERTIFICATE = "certificates" RESOURCE_TYPE_SYSINV_DNS = "idns" -RESOURCE_TYPE_SYSINV_SNMP_COMM = "icommunity" -RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST = "itrapdest" RESOURCE_TYPE_SYSINV_USER = "iuser" RESOURCE_TYPE_SYSINV_FERNET_REPO = "fernet_repo" diff --git a/distributedcloud/dcorch/engine/sync_services/sysinv.py b/distributedcloud/dcorch/engine/sync_services/sysinv.py index 9c94b86bd..3df56e9ae 100644 --- a/distributedcloud/dcorch/engine/sync_services/sysinv.py +++ b/distributedcloud/dcorch/engine/sync_services/sysinv.py @@ -42,9 +42,6 @@ class SysinvSyncThread(SyncThread): consts.RESOURCE_TYPE_SYSINV_FERNET_REPO ] - SYSINV_ADD_DELETE_RESOURCES = [consts.RESOURCE_TYPE_SYSINV_SNMP_COMM, - consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST] - SYSINV_CREATE_RESOURCES = [consts.RESOURCE_TYPE_SYSINV_CERTIFICATE, consts.RESOURCE_TYPE_SYSINV_FERNET_REPO] @@ -60,10 +57,6 @@ class SysinvSyncThread(SyncThread): self.sync_handler_map = { consts.RESOURCE_TYPE_SYSINV_DNS: self.sync_platform_resource, - consts.RESOURCE_TYPE_SYSINV_SNMP_COMM: - self.sync_platform_resource, - consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST: - self.sync_platform_resource, consts.RESOURCE_TYPE_SYSINV_CERTIFICATE: self.sync_platform_resource, consts.RESOURCE_TYPE_SYSINV_USER: @@ -78,8 +71,6 @@ class SysinvSyncThread(SyncThread): self.audit_resources = [ consts.RESOURCE_TYPE_SYSINV_CERTIFICATE, consts.RESOURCE_TYPE_SYSINV_DNS, - consts.RESOURCE_TYPE_SYSINV_SNMP_COMM, - consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST, consts.RESOURCE_TYPE_SYSINV_USER, consts.RESOURCE_TYPE_SYSINV_FERNET_REPO, ] @@ -164,141 +155,6 @@ class SysinvSyncThread(SyncThread): .format(rsrc.id, subcloud_rsrc_id, nameservers), extra=self.log_extra) - def sync_itrapdest(self, s_os_client, request, rsrc): - switcher = { - consts.OPERATION_TYPE_POST: self.snmp_trapdest_create, - consts.OPERATION_TYPE_CREATE: self.snmp_trapdest_create, - consts.OPERATION_TYPE_DELETE: self.snmp_trapdest_delete, - } - - func = switcher[request.orch_job.operation_type] - try: - func(s_os_client, request, rsrc) - except Exception as e: - LOG.exception(e) - raise e - - def snmp_trapdest_create(self, s_os_client, request, rsrc): - LOG.info("snmp_trapdest_create region {} resource_info={}".format( - self.subcloud_engine.subcloud.region_name, - request.orch_job.resource_info), - extra=self.log_extra) - resource_info_dict = jsonutils.loads(request.orch_job.resource_info) - payload = resource_info_dict.get('payload') - if not payload: - payload = resource_info_dict - - try: - itrapdest = s_os_client.sysinv_client.snmp_trapdest_create( - payload) - itrapdest_id = itrapdest.uuid - ip_address = itrapdest.ip_address - except (AttributeError, TypeError) as e: - LOG.info("snmp_trapdest_create error {}".format(e), - extra=self.log_extra) - raise exceptions.SyncRequestFailedRetry - - # Now persist the subcloud resource to the DB for later - subcloud_rsrc_id = self.persist_db_subcloud_resource( - rsrc.id, ip_address) - - LOG.info("SNMP trapdest {}:{} [{}/{}] created".format(rsrc.id, - subcloud_rsrc_id, ip_address, itrapdest_id), - extra=self.log_extra) - return itrapdest - - def snmp_trapdest_delete(self, s_os_client, request, rsrc): - subcloud_rsrc = self.get_db_subcloud_resource(rsrc.id) - if not subcloud_rsrc: - return - - try: - s_os_client.sysinv_client.snmp_trapdest_delete( - subcloud_rsrc.subcloud_resource_id) - except dccommon_exceptions.TrapDestNotFound: - # SNMP trapdest already deleted in subcloud, carry on. - LOG.info("SNMP trapdest not in subcloud, may be already deleted", - extra=self.log_extra) - except (AttributeError, TypeError) as e: - LOG.info("snmp_trapdest_delete error {}".format(e), - extra=self.log_extra) - raise exceptions.SyncRequestFailedRetry - - subcloud_rsrc.delete() - # Master Resource can be deleted only when all subcloud resources - # are deleted along with corresponding orch_job and orch_requests. - LOG.info("SNMP trapdest {}:{} [{}] deleted".format( - rsrc.id, subcloud_rsrc.id, - subcloud_rsrc.subcloud_resource_id), - extra=self.log_extra) - - def sync_icommunity(self, s_os_client, request, rsrc): - switcher = { - consts.OPERATION_TYPE_POST: self.snmp_community_create, - consts.OPERATION_TYPE_CREATE: self.snmp_community_create, - consts.OPERATION_TYPE_DELETE: self.snmp_community_delete, - } - - func = switcher[request.orch_job.operation_type] - try: - func(s_os_client, request, rsrc) - except Exception as e: - LOG.exception(e) - raise exceptions.SyncRequestFailedRetry - - def snmp_community_create(self, s_os_client, request, rsrc): - LOG.info("snmp_community_create region {} resource_info={}".format( - self.subcloud_engine.subcloud.region_name, - request.orch_job.resource_info), - extra=self.log_extra) - resource_info_dict = jsonutils.loads(request.orch_job.resource_info) - payload = resource_info_dict.get('payload') - if not payload: - payload = resource_info_dict - - try: - icommunity = s_os_client.sysinv_client.snmp_community_create( - payload) - icommunity_id = icommunity.uuid - community = icommunity.community - except (AttributeError, TypeError) as e: - LOG.info("snmp_community_create error {}".format(e), - extra=self.log_extra) - raise exceptions.SyncRequestFailedRetry - - # Now persist the subcloud resource to the DB for later - subcloud_rsrc_id = self.persist_db_subcloud_resource( - rsrc.id, community) - - LOG.info("SNMP community {}:{} [{}/{}] created".format(rsrc.id, - subcloud_rsrc_id, community, icommunity_id), - extra=self.log_extra) - return icommunity - - def snmp_community_delete(self, s_os_client, request, rsrc): - subcloud_rsrc = self.get_db_subcloud_resource(rsrc.id) - if not subcloud_rsrc: - return - try: - s_os_client.sysinv_client.snmp_community_delete( - subcloud_rsrc.subcloud_resource_id) - except dccommon_exceptions.CommunityNotFound: - # Community already deleted in subcloud, carry on. - LOG.info("SNMP community not in subcloud, may be already deleted", - extra=self.log_extra) - except (AttributeError, TypeError) as e: - LOG.info("snmp_community_delete error {}".format(e), - extra=self.log_extra) - raise exceptions.SyncRequestFailedRetry - - subcloud_rsrc.delete() - # Master Resource can be deleted only when all subcloud resources - # are deleted along with corresponding orch_job and orch_requests. - LOG.info("SNMP community {}:{} [{}] deleted".format( - rsrc.id, subcloud_rsrc.id, - subcloud_rsrc.subcloud_resource_id), - extra=self.log_extra) - def update_certificate(self, s_os_client, signature, certificate=None, data=None): @@ -577,10 +433,6 @@ class SysinvSyncThread(SyncThread): thread_name=self.audit_thread.name) if resource_type == consts.RESOURCE_TYPE_SYSINV_DNS: return [self.get_dns_resource(os_client)] - elif resource_type == consts.RESOURCE_TYPE_SYSINV_SNMP_COMM: - return self.get_snmp_community_resources(os_client) - elif resource_type == consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST: - return self.get_snmp_trapdest_resources(os_client) elif resource_type == consts.RESOURCE_TYPE_SYSINV_CERTIFICATE: return self.get_certificates_resources(os_client) elif resource_type == consts.RESOURCE_TYPE_SYSINV_USER: @@ -601,10 +453,6 @@ class SysinvSyncThread(SyncThread): thread_name=self.audit_thread.name) if resource_type == consts.RESOURCE_TYPE_SYSINV_DNS: return [self.get_dns_resource(os_client)] - elif resource_type == consts.RESOURCE_TYPE_SYSINV_SNMP_COMM: - return self.get_snmp_community_resources(os_client) - elif resource_type == consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST: - return self.get_snmp_trapdest_resources(os_client) elif resource_type == consts.RESOURCE_TYPE_SYSINV_CERTIFICATE: return self.get_certificates_resources(os_client) elif resource_type == consts.RESOURCE_TYPE_SYSINV_USER: @@ -649,12 +497,6 @@ class SysinvSyncThread(SyncThread): def get_dns_resource(self, os_client): return os_client.sysinv_client.get_dns() - def get_snmp_trapdest_resources(self, os_client): - return os_client.sysinv_client.snmp_trapdest_list() - - def get_snmp_community_resources(self, os_client): - return os_client.sysinv_client.snmp_community_list() - def get_certificates_resources(self, os_client): certificate_list = os_client.sysinv_client.get_certificates() # Filter SSL certificates to avoid sync @@ -672,17 +514,7 @@ class SysinvSyncThread(SyncThread): return FernetKeyManager.to_resource_info(keys) def get_resource_id(self, resource_type, resource): - if resource_type == consts.RESOURCE_TYPE_SYSINV_SNMP_COMM: - LOG.debug("get_resource_id for community {}".format(resource)) - return resource.community - elif resource_type == consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST: - if hasattr(resource, 'ip_address') and \ - hasattr(resource, 'community'): - LOG.debug("get_resource_id resource={} has ip_address and " - "community".format(resource), - extra=self.log_extra) - return resource.ip_address - elif resource_type == consts.RESOURCE_TYPE_SYSINV_CERTIFICATE: + if resource_type == consts.RESOURCE_TYPE_SYSINV_CERTIFICATE: if hasattr(resource, 'signature'): LOG.debug("get_resource_id signature={}".format( resource.signature)) @@ -725,22 +557,6 @@ class SysinvSyncThread(SyncThread): same_nameservers = False return same_nameservers - def same_snmp_trapdest(self, i1, i2): - LOG.debug("same_snmp_trapdest i1={}, i2={}".format(i1, i2), - extra=self.log_extra) - return (i1.ip_address == i2.ip_address and - i1.community == i2.community) - - def same_snmp_community(self, i1, i2): - LOG.debug("same_snmp_community i1={}, i2={}".format(i1, i2), - extra=self.log_extra) - if i1.community and (i1.community != i2.community): - if i1.signature == self.RESOURCE_UUID_NULL: - LOG.info("Master Resource SNMP Community NULL UUID") - return True - return False - return True - def same_certificate(self, i1, i2): LOG.debug("same_certificate i1={}, i2={}".format(i1, i2), extra=self.log_extra) @@ -780,10 +596,6 @@ class SysinvSyncThread(SyncThread): def same_resource(self, resource_type, m_resource, sc_resource): if resource_type == consts.RESOURCE_TYPE_SYSINV_DNS: return self.same_dns(m_resource, sc_resource) - elif resource_type == consts.RESOURCE_TYPE_SYSINV_SNMP_COMM: - return self.same_snmp_community(m_resource, sc_resource) - elif resource_type == consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST: - return self.same_snmp_trapdest(m_resource, sc_resource) elif resource_type == consts.RESOURCE_TYPE_SYSINV_CERTIFICATE: return self.same_certificate(m_resource, sc_resource) elif resource_type == consts.RESOURCE_TYPE_SYSINV_USER: @@ -797,17 +609,8 @@ class SysinvSyncThread(SyncThread): def audit_discrepancy(self, resource_type, m_resource, sc_resources): # Return true to try the audit_action - if resource_type in self.SYSINV_ADD_DELETE_RESOURCES: - # It could be that the details are different - # between master cloud and subcloud now. - # Thus, delete the resource before creating it again. - master_id = self.get_resource_id(resource_type, m_resource) - self.schedule_work(self.endpoint_type, resource_type, - master_id, - consts.OPERATION_TYPE_DELETE) - return True - elif (resource_type in self.SYSINV_MODIFY_RESOURCES or - resource_type in self.SYSINV_CREATE_RESOURCES): + if (resource_type in self.SYSINV_MODIFY_RESOURCES or + resource_type in self.SYSINV_CREATE_RESOURCES): # The resource differs, signal to perform the audit_action return True @@ -880,8 +683,6 @@ class SysinvSyncThread(SyncThread): def get_resource_info(self, resource_type, resource, operation_type=None): payload_resources = [consts.RESOURCE_TYPE_SYSINV_DNS, - consts.RESOURCE_TYPE_SYSINV_SNMP_COMM, - consts.RESOURCE_TYPE_SYSINV_SNMP_TRAPDEST, consts.RESOURCE_TYPE_SYSINV_CERTIFICATE, consts.RESOURCE_TYPE_SYSINV_USER, ] diff --git a/distributedcloud/requirements.txt b/distributedcloud/requirements.txt index de103237e..03b985016 100644 --- a/distributedcloud/requirements.txt +++ b/distributedcloud/requirements.txt @@ -11,7 +11,7 @@ Paste # MIT PasteDeploy>=1.5.0 # MIT Routes>=2.3.1 # MIT debtcollector>=1.2.0 # Apache-2.0 -eventlet!=0.18.3,<0.21.0,>=0.18.2 # MIT +eventlet pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 # BSD greenlet>=0.3.2 # MIT httplib2>=0.7.5 # MIT diff --git a/distributedcloud/test-requirements.txt b/distributedcloud/test-requirements.txt index 4a3d15625..216f21e41 100644 --- a/distributedcloud/test-requirements.txt +++ b/distributedcloud/test-requirements.txt @@ -8,7 +8,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0 # BSD python-subunit>=0.0.18 # Apache-2.0/BSD requests-mock>=1.1 # Apache-2.0 -sphinx!=1.6.1,>=1.5.1 # BSD +sphinx # BSD oslosphinx>=4.7.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testtools>=1.4.0 # MIT diff --git a/distributedcloud/tox.ini b/distributedcloud/tox.ini index b5c649ba7..4d31c0e8b 100644 --- a/distributedcloud/tox.ini +++ b/distributedcloud/tox.ini @@ -16,8 +16,7 @@ cgtsclient_src_dir = ../../config/sysinv/cgts-client/cgts-client cgcs_patch_src_dir = ../../update/cgcs-patch/cgcs-patch [testenv] -install_command = pip install \ - -c ./upper-constraints.txt \ +install_command = pip install -v -v -v \ -c https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt \ {opts} {packages} setenv = @@ -38,6 +37,9 @@ whitelist_externals = [testenv:py27] basepython = python2.7 +install_command = pip install -v -v -v \ + -c https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt \ + {opts} {packages} deps = -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt keyring @@ -86,7 +88,6 @@ commands = oslo_debug_helper {posargs} basepython = python3 deps = hacking>=1.1.0,<=2.0.0 pycodestyle>=2.0.0 - flake8-bugbear commands = flake8 [testenv:venv] @@ -168,15 +169,8 @@ show-source = True # E402 module level import not at top of file # E501 line too long # E731 do not assign a lambda expression, use a def -# -B- codes are bugbear errors -# B005 Using .strip() with multi-character strings is misleading the reader. -# B006 Do not use mutable data structures for argument defaults. -# B007 Loop control variable not used within the loop body. -# B009 Do not call getattr with a constant attribute value, -# B306 `BaseException.message` has been deprecated as of Python 2.6 and is removed in Python 3 ignore = W503,W504,W605, - E117,E123,E125,E305,E402,E501,E731, - B005,B006,B007,B009,B306 + E117,E123,E125,E305,E402,E501,E731 builtins = _ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build diff --git a/distributedcloud/upper-constraints.txt b/distributedcloud/upper-constraints.txt deleted file mode 100644 index e74681b7e..000000000 --- a/distributedcloud/upper-constraints.txt +++ /dev/null @@ -1,5 +0,0 @@ -# oslo.messaging locked to pike version -# https://bugs.launchpad.net/starlingx/+bug/1865054 -oslo.messaging==5.30.6 # Apache-2.0 -Pygments==2.5.2 - diff --git a/doc/requirements.txt b/doc/requirements.txt index d197d454a..aaf3f7603 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,8 +1,8 @@ -sphinx>=1.6.2 -openstackdocstheme>=1.26.0 # Apache-2.0 +sphinx # BSD +openstackdocstheme # Apache-2.0 # Release Notes documentation -reno>=0.1.1 # Apache2 +reno # Apache-2.0 # Api Ref documentation os-api-ref>=1.4.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 062ab2ac8..994119e26 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ minversion = 2.3 skipsdist = True [testenv] -install_command = pip install \ +install_command = pip install -v -v -v \ -c https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt \ {opts} {packages} setenv =