Merge branch 'master' of code.ungleich.ch:ucloud/ucloud

This commit is contained in:
llnu 2019-12-08 14:04:50 +01:00
commit 34a6e99525
3 changed files with 5 additions and 22 deletions

View file

@ -54,8 +54,4 @@ CEPH_IMG_POOL =
# Importing uploaded files
FILE_DIR = /var/lib/ucloud/files
FILE_PREFIX = noclue-ahmed
[ssh]
SSH_USERNAME =
SSH_PRIVATEKEY =
FILE_PREFIX = noclue-ahmed

View file

@ -5,18 +5,14 @@ from ucloud.common.request import RequestPool
from ucloud.common.vm import VmPool
from ucloud.common.storage_handlers import FileSystemBasedImageStorageHandler, CEPHBasedImageStorageHandler
from decouple import Config, RepositoryEnv, RepositoryEmpty
# Replacing decouple inline
import configparser
import os
import os.path
import logging
log = logging.getLogger("ucloud.config")
conf_name = "ucloud.conf"
try:
@ -34,14 +30,6 @@ try:
except FileNotFoundError:
log.warn("Configuration file not found - using defaults")
# Try importing config, but don't fail if it does not exist
# try:
# env_vars = Config(RepositoryEnv('/etc/ucloud/ucloud.conf'))
# except FileNotFoundError:
# env_vars = Config(RepositoryEmpty())
etcd_wrapper_args = ()
etcd_wrapper_kwargs = {
'host': config['etcd']['ETCD_URL'],

View file

@ -6,7 +6,7 @@ import time
from uuid import uuid4
from . import logger
from ucloud.config import env_vars, etcd_client
from ucloud.config import config, etcd_client
def getxattr(file, attr):
@ -37,7 +37,7 @@ def setxattr(file, attr, value):
def sha512sum(file: str):
"""Use sha512sum utility to compute sha512 sum of arg:file
IF arg:file does not exists:
raise FileNotFoundError exception
ELSE IF sum successfully computer:
@ -69,9 +69,8 @@ except Exception as e:
def main():
BASE_DIR = env_vars.get("BASE_DIR")
FILE_PREFIX = env_vars.get("FILE_PREFIX")
BASE_DIR = config['storage']["FILE_DIR"]
FILE_PREFIX = config['storage']["FILE_PREFIX"]
# Recursively Get All Files and Folder below BASE_DIR
files = glob.glob("{}/**".format(BASE_DIR), recursive=True)