From 7023a2f71c3374cbe3cece0ac0798a80e7fc5fd4 Mon Sep 17 00:00:00 2001 From: agarwalat Date: Fri, 13 Nov 2020 08:43:04 +0000 Subject: [PATCH] Resolved bug 1293 - Remove all references of peewee, mysql, libmysql-dev as mysql is not supported anymore. Change-Id: Iab527c7b76d7c5a47cbe653686ae32381f91b414 Signed-off-by: agarwalat --- Dockerfile | 2 +- debian/python3-osm-mon.postinst | 2 - docker/Dockerfile | 2 +- osm_mon/collector/collector.py | 5 -- osm_mon/dashboarder/dashboarder.py | 4 -- osm_mon/evaluator/evaluator.py | 5 -- osm_mon/migrations/001_initial.py | 102 ----------------------------- requirements.txt | 2 - setup.py | 2 - stdeb.cfg | 19 +++++- 10 files changed, 20 insertions(+), 125 deletions(-) delete mode 100644 osm_mon/migrations/001_initial.py diff --git a/Dockerfile b/Dockerfile index db227e7..376bb2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,5 +25,5 @@ FROM ubuntu:18.04 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get --yes install git tox make python-all python3 python3-pip debhelper wget && \ - DEBIAN_FRONTEND=noninteractive apt-get --yes install libmysqlclient-dev libxml2 python3-all libssl-dev && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install libxml2 python3-all libssl-dev && \ DEBIAN_FRONTEND=noninteractive pip3 install -U setuptools setuptools-version-command stdeb diff --git a/debian/python3-osm-mon.postinst b/debian/python3-osm-mon.postinst index a877104..a097dff 100644 --- a/debian/python3-osm-mon.postinst +++ b/debian/python3-osm-mon.postinst @@ -27,13 +27,11 @@ pip3 install aiokafka==0.6.0 pip3 install requests==2.18.* pip3 install python-keystoneclient==3.15.* pip3 install six -pip3 install peewee==3.8.* pip3 install pyyaml>=5.1.2 pip3 install prometheus_client==0.4.* pip3 install gnocchiclient==7.0.* pip3 install pyvcloud==19.1.1 pip3 install python-ceilometerclient==2.9.* pip3 install python-novaclient==12.0.* -pip3 install pymysql==0.9.* pip3 install python-neutronclient==5.1.* echo "Installation of python dependencies finished" diff --git a/docker/Dockerfile b/docker/Dockerfile index 5032aad..a9062c9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,7 +25,7 @@ FROM ubuntu:18.04 LABEL authors="Benjamín Díaz" RUN apt-get --yes update \ - && apt-get --yes install git python3 python3-pip libmysqlclient-dev libssl-dev libffi-dev mysql-client \ + && apt-get --yes install git python3 python3-pip libssl-dev libffi-dev \ && python3 -m pip install -U pip COPY requirements.txt /mon/requirements.txt diff --git a/osm_mon/collector/collector.py b/osm_mon/collector/collector.py index cc84436..ad166e4 100644 --- a/osm_mon/collector/collector.py +++ b/osm_mon/collector/collector.py @@ -23,8 +23,6 @@ import logging import time -import peewee - from osm_mon.collector.backends.prometheus import PrometheusBackend from osm_mon.collector.service import CollectorService from osm_mon.core.config import Config @@ -49,9 +47,6 @@ class Collector: try: self.collect_metrics() time.sleep(int(self.conf.get('collector', 'interval'))) - except peewee.PeeweeException: - log.exception("Database error consuming message: ") - raise except Exception: log.exception("Error collecting metrics") diff --git a/osm_mon/dashboarder/dashboarder.py b/osm_mon/dashboarder/dashboarder.py index 30f27d1..cab9a68 100644 --- a/osm_mon/dashboarder/dashboarder.py +++ b/osm_mon/dashboarder/dashboarder.py @@ -23,7 +23,6 @@ import logging import time import socket -import peewee import asyncio from osm_mon.dashboarder.service import DashboarderService @@ -96,9 +95,6 @@ class Dashboarder: try: self.create_dashboards() time.sleep(int(self.conf.get('dashboarder', 'interval'))) - except peewee.PeeweeException: - log.exception("Database error consuming message: ") - raise except Exception: log.exception("Error creating dashboards") diff --git a/osm_mon/evaluator/evaluator.py b/osm_mon/evaluator/evaluator.py index 7e86743..8d4c276 100644 --- a/osm_mon/evaluator/evaluator.py +++ b/osm_mon/evaluator/evaluator.py @@ -25,8 +25,6 @@ import logging import multiprocessing import time -import peewee - from osm_mon.core.config import Config from osm_mon.core.message_bus_client import MessageBusClient from osm_mon.core.models import Alarm @@ -52,9 +50,6 @@ class Evaluator: try: self.evaluate() time.sleep(int(self.conf.get('evaluator', 'interval'))) - except peewee.PeeweeException: - log.exception("Database error evaluating alarms: ") - raise except Exception: log.exception("Error evaluating alarms") diff --git a/osm_mon/migrations/001_initial.py b/osm_mon/migrations/001_initial.py deleted file mode 100644 index 346e9c1..0000000 --- a/osm_mon/migrations/001_initial.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2018 Whitestack, LLC -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Whitestack, LLC - -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# For those usages not covered by the Apache License, Version 2.0 please -# contact: bdiaz@whitestack.com or glavado@whitestack.com -## -"""Peewee migrations -- 001_initial.py. - -Some examples (model - class or model name):: - - > Model = migrator.orm['model_name'] # Return model in current state by name - - > migrator.sql(sql) # Run custom SQL - > migrator.python(func, *args, **kwargs) # Run python code - > migrator.create_model(Model) # Create a model (could be used as decorator) - > migrator.remove_model(model, cascade=True) # Remove a model - > migrator.add_fields(model, **fields) # Add fields to a model - > migrator.change_fields(model, **fields) # Change fields - > migrator.remove_fields(model, *field_names, cascade=True) - > migrator.rename_field(model, old_field_name, new_field_name) - > migrator.rename_table(model, new_table_name) - > migrator.add_index(model, *col_names, unique=False) - > migrator.drop_index(model, *col_names) - > migrator.add_not_null(model, *field_names) - > migrator.drop_not_null(model, *field_names) - > migrator.add_default(model, field_name, default) - -""" - -import peewee as pw - -SQL = pw.SQL - - -def migrate(migrator, database, fake=False, **kwargs): - """Write your migrations here.""" - - @migrator.create_model - class Alarm(pw.Model): - id = pw.AutoField() - uuid = pw.CharField(max_length=255, unique=True) - name = pw.CharField(max_length=255) - severity = pw.CharField(max_length=255) - threshold = pw.FloatField() - operation = pw.CharField(max_length=255) - statistic = pw.CharField(max_length=255) - monitoring_param = pw.CharField(max_length=255) - vdur_name = pw.CharField(max_length=255) - vnf_member_index = pw.CharField(max_length=255) - nsr_id = pw.CharField(max_length=255) - - class Meta: - table_name = "alarm" - - @migrator.create_model - class BaseModel(pw.Model): - id = pw.AutoField() - - class Meta: - table_name = "basemodel" - - @migrator.create_model - class VimCredentials(pw.Model): - id = pw.AutoField() - uuid = pw.CharField(max_length=255, unique=True) - name = pw.CharField(max_length=255) - type = pw.CharField(max_length=255) - url = pw.CharField(max_length=255) - user = pw.CharField(max_length=255) - password = pw.CharField(max_length=255) - tenant_name = pw.CharField(max_length=255) - config = pw.TextField() - - class Meta: - table_name = "vimcredentials" - - -def rollback(migrator, database, fake=False, **kwargs): - """Write your rollback migrations here.""" - - migrator.remove_model('vimcredentials') - - migrator.remove_model('basemodel') - - migrator.remove_model('alarm') diff --git a/requirements.txt b/requirements.txt index bb30885..558f045 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,11 +22,9 @@ aiokafka==0.6.0 requests==2.18.* python-keystoneclient==3.15.* six -peewee==3.8.* pyyaml>=5.1.2 prometheus_client==0.4.* gnocchiclient==7.0.* -pymysql==0.9.* pyvcloud==19.1.* python-ceilometerclient==2.9.* python-novaclient==12.0.* diff --git a/setup.py b/setup.py index afeb968..485ed51 100644 --- a/setup.py +++ b/setup.py @@ -55,14 +55,12 @@ setup( "requests==2.18.*", "python-keystoneclient==3.15.*", "six", - "peewee==3.8.*", "pyyaml>=5.1.2", "prometheus_client==0.4.*", "gnocchiclient==7.0.*", "pyvcloud==19.1.1", "python-ceilometerclient==2.9.*", "python-novaclient==12.0.*", - "pymysql==0.9.*", "python-neutronclient==5.1.*", "osm-common", "n2vc" diff --git a/stdeb.cfg b/stdeb.cfg index 1490634..cb16aaa 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,3 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + [DEFAULT] X-Python3-Version : >= 3.4 -Depends3 : libmysqlclient-dev, libssl-dev, libffi-dev, libxml2-dev, libxslt-dev, python3-pip, python3-osm-common, python3-n2vc \ No newline at end of file +Depends3 : libssl-dev, libffi-dev, libxml2-dev, libxslt-dev, python3-pip, python3-osm-common, python3-n2vc -- 2.17.1