diff --git a/api-daemon/provisioner/examples/dummy_script.py b/api-daemon/provisioner/examples/dummy_script.py index 08d234ba..caa594a5 100644 --- a/api-daemon/provisioner/examples/dummy_script.py +++ b/api-daemon/provisioner/examples/dummy_script.py @@ -30,8 +30,6 @@ # This script will run under root privileges as the provisioner does. Be careful # with that. -import os - # Installation function - performs a debootstrap install of a Debian system # Note that the only arguments are keyword arguments. def install(**kwargs): diff --git a/api-daemon/pvcapid-manage.py b/api-daemon/pvcapid-manage.py index 0de43342..60d2349d 100755 --- a/api-daemon/pvcapid-manage.py +++ b/api-daemon/pvcapid-manage.py @@ -20,11 +20,10 @@ # ############################################################################### -import os from flask_migrate import Migrate, MigrateCommand from flask_script import Manager -from pvcapid.flaskapi import app, db, config +from pvcapid.flaskapi import app, db migrate = Migrate(app, db) manager = Manager(app) diff --git a/api-daemon/pvcapid.py b/api-daemon/pvcapid.py index 2caaf148..8d0c1d3b 100755 --- a/api-daemon/pvcapid.py +++ b/api-daemon/pvcapid.py @@ -20,4 +20,4 @@ # ############################################################################### -import pvcapid.Daemon +import pvcapid.Daemon # noqa: F401 diff --git a/api-daemon/pvcapid/benchmark.py b/api-daemon/pvcapid/benchmark.py index 9688c8b9..d2ce29c6 100755 --- a/api-daemon/pvcapid/benchmark.py +++ b/api-daemon/pvcapid/benchmark.py @@ -20,26 +20,14 @@ # ############################################################################### -import flask -import json import psycopg2 import psycopg2.extras -import os -import re -import time -import shlex -import subprocess from distutils.util import strtobool as dustrtobool import daemon_lib.common as pvc_common -import daemon_lib.node as pvc_node import daemon_lib.ceph as pvc_ceph -import pvcapid.libvirt_schema as libvirt_schema - -from pvcapid.ova import list_ova - def strtobool(stringv): if stringv is None: return False diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index 6d109b84..f3ab5bee 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -20,22 +20,14 @@ # ############################################################################### -import json import yaml import os - -import gevent.pywsgi - import flask from distutils.util import strtobool as dustrtobool - from functools import wraps - from flask_restful import Resource, Api, reqparse, abort - from celery import Celery -from celery.task.control import inspect import pvcapid.helper as api_helper import pvcapid.provisioner as api_provisioner diff --git a/api-daemon/pvcapid/helper.py b/api-daemon/pvcapid/helper.py index 9446ba1c..ea79980c 100755 --- a/api-daemon/pvcapid/helper.py +++ b/api-daemon/pvcapid/helper.py @@ -21,7 +21,6 @@ ############################################################################### import flask -import json import lxml.etree as etree from distutils.util import strtobool as dustrtobool diff --git a/api-daemon/pvcapid/models.py b/api-daemon/pvcapid/models.py index c4799b64..f9f77344 100755 --- a/api-daemon/pvcapid/models.py +++ b/api-daemon/pvcapid/models.py @@ -20,7 +20,7 @@ # ############################################################################### -from pvcapid.flaskapi import app, db +from pvcapid.flaskapi import db class DBSystemTemplate(db.Model): __tablename__ = 'system_template' diff --git a/api-daemon/pvcapid/ova.py b/api-daemon/pvcapid/ova.py index 432bbc96..3fe2b71a 100755 --- a/api-daemon/pvcapid/ova.py +++ b/api-daemon/pvcapid/ova.py @@ -21,29 +21,19 @@ ############################################################################### import flask -import json import psycopg2 import psycopg2.extras -import os import re -import time import math import tarfile -import shutil -import shlex -import subprocess import lxml.etree from werkzeug.formparser import parse_form_data import daemon_lib.common as pvc_common -import daemon_lib.node as pvc_node -import daemon_lib.vm as pvc_vm -import daemon_lib.network as pvc_network import daemon_lib.ceph as pvc_ceph -import pvcapid.libvirt_schema as libvirt_schema import pvcapid.provisioner as provisioner # diff --git a/api-daemon/pvcapid/provisioner.py b/api-daemon/pvcapid/provisioner.py index 5c62ad60..66d8c5a3 100755 --- a/api-daemon/pvcapid/provisioner.py +++ b/api-daemon/pvcapid/provisioner.py @@ -20,15 +20,10 @@ # ############################################################################### -import flask import json import psycopg2 import psycopg2.extras -import os import re -import time -import shlex -import subprocess from distutils.util import strtobool as dustrtobool diff --git a/client-cli/cli_lib/ceph.py b/client-cli/cli_lib/ceph.py index 52ffe12b..b36de0ad 100644 --- a/client-cli/cli_lib/ceph.py +++ b/client-cli/cli_lib/ceph.py @@ -20,9 +20,7 @@ # ############################################################################### -import re import json -import time import math from requests_toolbelt.multipart.encoder import MultipartEncoder, MultipartEncoderMonitor diff --git a/client-cli/cli_lib/common.py b/client-cli/cli_lib/common.py index 78a13653..540af162 100644 --- a/client-cli/cli_lib/common.py +++ b/client-cli/cli_lib/common.py @@ -21,7 +21,6 @@ ############################################################################### import os -import io import math import time import requests diff --git a/client-cli/cli_lib/network.py b/client-cli/cli_lib/network.py index bba84992..624428f4 100644 --- a/client-cli/cli_lib/network.py +++ b/client-cli/cli_lib/network.py @@ -20,9 +20,6 @@ # ############################################################################### -import difflib -import colorama - import cli_lib.ansiprint as ansiprint from cli_lib.common import call_api diff --git a/client-cli/cli_lib/provisioner.py b/client-cli/cli_lib/provisioner.py index f1544f93..c4cd44da 100644 --- a/client-cli/cli_lib/provisioner.py +++ b/client-cli/cli_lib/provisioner.py @@ -20,9 +20,6 @@ # ############################################################################### -import time -import re -import subprocess import ast from requests_toolbelt.multipart.encoder import MultipartEncoder, MultipartEncoderMonitor diff --git a/client-cli/cli_lib/vm.py b/client-cli/cli_lib/vm.py index c133e182..e07057fb 100644 --- a/client-cli/cli_lib/vm.py +++ b/client-cli/cli_lib/vm.py @@ -22,12 +22,8 @@ import time import re -import subprocess - -from collections import deque import cli_lib.ansiprint as ansiprint -import cli_lib.ceph as ceph from cli_lib.common import call_api, format_bytes, format_metric # diff --git a/client-cli/cli_lib/zkhandler.py b/client-cli/cli_lib/zkhandler.py index 21fc194d..bd9e00fa 100644 --- a/client-cli/cli_lib/zkhandler.py +++ b/client-cli/cli_lib/zkhandler.py @@ -20,11 +20,8 @@ # ############################################################################### -import kazoo.client import uuid -import daemon_lib.ansiprint as ansiprint - # Exists function def exists(zk_conn, key): stat = zk_conn.exists(key) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index d4f09c22..fb0860fd 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -22,10 +22,7 @@ import socket import click -import tempfile import os -import stat -import subprocess import difflib import re import time diff --git a/daemon-common/cluster.py b/daemon-common/cluster.py index 99be4bd7..438a1e5d 100644 --- a/daemon-common/cluster.py +++ b/daemon-common/cluster.py @@ -20,12 +20,8 @@ # ############################################################################### -import json import re -from distutils.util import strtobool - -import daemon_lib.ansiprint as ansiprint import daemon_lib.zkhandler as zkhandler import daemon_lib.common as common import daemon_lib.vm as pvc_vm diff --git a/daemon-common/common.py b/daemon-common/common.py index 6bb53aa3..d1a4b8aa 100644 --- a/daemon-common/common.py +++ b/daemon-common/common.py @@ -22,7 +22,6 @@ import uuid import lxml -import math import shlex import subprocess import kazoo.client diff --git a/daemon-common/network.py b/daemon-common/network.py index 01a92c49..687c9fa4 100644 --- a/daemon-common/network.py +++ b/daemon-common/network.py @@ -20,23 +20,13 @@ # ############################################################################### -import os -import socket -import time -import uuid import re -import tempfile -import subprocess -import difflib -import colorama import click -import lxml.objectify -import configparser -import kazoo.client + +from kazoo.exceptions import NoNodeError import daemon_lib.ansiprint as ansiprint import daemon_lib.zkhandler as zkhandler -import daemon_lib.common as common # # Cluster search functions @@ -172,7 +162,7 @@ def getDHCPLeaseInformation(zk_conn, vni, mac_address): try: zkhandler.readdata(zk_conn, '/networks/{}/dhcp4_leases/{}'.format(vni, mac_address)) type_key = 'dhcp4_leases' - except kazoo.exceptions.NoNodeError: + except NoNodeError: zkhandler.readdata(zk_conn, '/networks/{}/dhcp4_reservations/{}'.format(vni, mac_address)) type_key = 'dhcp4_reservations' diff --git a/daemon-common/node.py b/daemon-common/node.py index 771ca647..96ea59e8 100644 --- a/daemon-common/node.py +++ b/daemon-common/node.py @@ -20,24 +20,13 @@ # ############################################################################### -import os -import socket import time -import uuid import re -import tempfile -import subprocess -import difflib -import colorama import click -import lxml.objectify -import configparser -import kazoo.client import daemon_lib.ansiprint as ansiprint import daemon_lib.zkhandler as zkhandler import daemon_lib.common as common -import daemon_lib.vm as pvc_vm def getNodeInformation(zk_conn, node_name): """ diff --git a/daemon-common/vm.py b/daemon-common/vm.py index 91c1562d..a6cb1730 100644 --- a/daemon-common/vm.py +++ b/daemon-common/vm.py @@ -20,20 +20,10 @@ # ############################################################################### -import os -import socket import time -import uuid import re -import subprocess -import difflib -import colorama import click import lxml.objectify -import configparser -import kazoo.client - -from collections import deque import daemon_lib.ansiprint as ansiprint import daemon_lib.zkhandler as zkhandler diff --git a/daemon-common/zkhandler.py b/daemon-common/zkhandler.py index 773b8837..31d8b6c1 100644 --- a/daemon-common/zkhandler.py +++ b/daemon-common/zkhandler.py @@ -20,11 +20,8 @@ # ############################################################################### -import kazoo.client import uuid -import daemon_lib.ansiprint as ansiprint - # Exists function def exists(zk_conn, key): stat = zk_conn.exists(key) diff --git a/node-daemon/pvcnoded.py b/node-daemon/pvcnoded.py index 5123469c..0bcb7c6c 100755 --- a/node-daemon/pvcnoded.py +++ b/node-daemon/pvcnoded.py @@ -20,4 +20,4 @@ # ############################################################################### -import pvcnoded.Daemon +import pvcnoded.Daemon # noqa: F401 diff --git a/node-daemon/pvcnoded/CephInstance.py b/node-daemon/pvcnoded/CephInstance.py index 2a82368e..b6d92c91 100644 --- a/node-daemon/pvcnoded/CephInstance.py +++ b/node-daemon/pvcnoded/CephInstance.py @@ -24,7 +24,6 @@ import time import json import psutil -import pvcnoded.log as log import pvcnoded.zkhandler as zkhandler import pvcnoded.common as common diff --git a/node-daemon/pvcnoded/DNSAggregatorInstance.py b/node-daemon/pvcnoded/DNSAggregatorInstance.py index 66bea260..11cb2a71 100644 --- a/node-daemon/pvcnoded/DNSAggregatorInstance.py +++ b/node-daemon/pvcnoded/DNSAggregatorInstance.py @@ -27,8 +27,6 @@ import psycopg2 from threading import Thread, Event -import pvcnoded.log as log -import pvcnoded.zkhandler as zkhandler import pvcnoded.common as common class DNSAggregatorInstance(object): diff --git a/node-daemon/pvcnoded/NodeInstance.py b/node-daemon/pvcnoded/NodeInstance.py index b7d4a553..104eef9f 100644 --- a/node-daemon/pvcnoded/NodeInstance.py +++ b/node-daemon/pvcnoded/NodeInstance.py @@ -24,7 +24,6 @@ import time from threading import Thread -import pvcnoded.log as log import pvcnoded.zkhandler as zkhandler import pvcnoded.common as common diff --git a/node-daemon/pvcnoded/VMConsoleWatcherInstance.py b/node-daemon/pvcnoded/VMConsoleWatcherInstance.py index 8105957d..e9b7470f 100644 --- a/node-daemon/pvcnoded/VMConsoleWatcherInstance.py +++ b/node-daemon/pvcnoded/VMConsoleWatcherInstance.py @@ -21,14 +21,11 @@ ############################################################################### import os -import uuid import time -import libvirt from threading import Thread, Event from collections import deque -import pvcnoded.log as log import pvcnoded.zkhandler as zkhandler class VMConsoleWatcherInstance(object): diff --git a/node-daemon/pvcnoded/VMInstance.py b/node-daemon/pvcnoded/VMInstance.py index d8ed5808..e6f5f055 100644 --- a/node-daemon/pvcnoded/VMInstance.py +++ b/node-daemon/pvcnoded/VMInstance.py @@ -27,7 +27,6 @@ import json from threading import Thread -import pvcnoded.log as log import pvcnoded.zkhandler as zkhandler import pvcnoded.common as common diff --git a/node-daemon/pvcnoded/VXNetworkInstance.py b/node-daemon/pvcnoded/VXNetworkInstance.py index 7839b4f0..f84f4f97 100644 --- a/node-daemon/pvcnoded/VXNetworkInstance.py +++ b/node-daemon/pvcnoded/VXNetworkInstance.py @@ -25,7 +25,6 @@ import time from textwrap import dedent -import pvcnoded.log as log import pvcnoded.zkhandler as zkhandler import pvcnoded.common as common diff --git a/node-daemon/pvcnoded/common.py b/node-daemon/pvcnoded/common.py index bc306ddf..6adcc689 100644 --- a/node-daemon/pvcnoded/common.py +++ b/node-daemon/pvcnoded/common.py @@ -22,12 +22,10 @@ import subprocess import signal -import time from threading import Thread from shlex import split as shlex_split -import pvcnoded.log as log import pvcnoded.zkhandler as zkhandler class OSDaemon(object):