[filescanner] use configparser
This commit is contained in:
parent
b235f0833c
commit
00563c7dc2
2 changed files with 14 additions and 6 deletions
|
@ -41,8 +41,17 @@ USER_PREFIX = users
|
||||||
VM_PREFIX = vms
|
VM_PREFIX = vms
|
||||||
|
|
||||||
[storage]
|
[storage]
|
||||||
STORAGE_BACKEND = #values = filesystem,
|
#values = filesystem, ceph
|
||||||
|
STORAGE_BACKEND =
|
||||||
|
|
||||||
|
# if STORAGE_BACKEND = filesystem
|
||||||
VM_DIR =
|
VM_DIR =
|
||||||
IMG_DIR =
|
IMG_DIR =
|
||||||
|
|
||||||
|
# if STORAGE_BACKEND = ceph
|
||||||
CEPH_VM_POOL =
|
CEPH_VM_POOL =
|
||||||
CEPH_IMG_POOL =
|
CEPH_IMG_POOL =
|
||||||
|
|
||||||
|
# Importing uploaded files
|
||||||
|
FILE_DIR = /var/lib/ucloud/files
|
||||||
|
FILE_PREFIX = noclue-ahmed
|
|
@ -6,7 +6,7 @@ import time
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from . import logger
|
from . import logger
|
||||||
from ucloud.config import env_vars, etcd_client
|
from ucloud.config import config, etcd_client
|
||||||
|
|
||||||
|
|
||||||
def getxattr(file, attr):
|
def getxattr(file, attr):
|
||||||
|
@ -69,9 +69,8 @@ except Exception as e:
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
BASE_DIR = env_vars.get("BASE_DIR")
|
BASE_DIR = config['storage']["FILE_DIR"]
|
||||||
|
FILE_PREFIX = config['storage']["FILE_PREFIX"]
|
||||||
FILE_PREFIX = env_vars.get("FILE_PREFIX")
|
|
||||||
|
|
||||||
# Recursively Get All Files and Folder below BASE_DIR
|
# Recursively Get All Files and Folder below BASE_DIR
|
||||||
files = glob.glob("{}/**".format(BASE_DIR), recursive=True)
|
files = glob.glob("{}/**".format(BASE_DIR), recursive=True)
|
||||||
|
|
Loading…
Reference in a new issue