Revamp config parsing and imports

Brings sanity to the passing of the config variable around the various
submodules for use in the ZKConnection decorator.
This commit is contained in:
2021-05-28 23:33:36 -04:00
parent 4554a0d6af
commit c6bececb55
6 changed files with 353 additions and 395 deletions

View File

@ -24,7 +24,7 @@ import psycopg2
import psycopg2.extras
import re
from distutils.util import strtobool as dustrtobool
from pvcapid.Daemon import config, strtobool
import daemon_lib.common as pvc_common
import daemon_lib.node as pvc_node
@ -36,19 +36,6 @@ import pvcapid.libvirt_schema as libvirt_schema
from pvcapid.ova import list_ova
config = None # Set in this namespace by flaskapi
def strtobool(stringv):
if stringv is None:
return False
if isinstance(stringv, bool):
return bool(stringv)
try:
return bool(dustrtobool(stringv))
except Exception:
return False
#
# Exceptions (used by Celery tasks)