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

@ -22,24 +22,11 @@
import psycopg2
import psycopg2.extras
from distutils.util import strtobool as dustrtobool
from pvcapid.Daemon import config
import daemon_lib.common as pvc_common
import daemon_lib.ceph as pvc_ceph
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)