Merge branch 'master' of code.ungleich.ch:ucloud/ucloud
This commit is contained in:
commit
34a6e99525
3 changed files with 5 additions and 22 deletions
|
@ -54,8 +54,4 @@ CEPH_IMG_POOL =
|
||||||
|
|
||||||
# Importing uploaded files
|
# Importing uploaded files
|
||||||
FILE_DIR = /var/lib/ucloud/files
|
FILE_DIR = /var/lib/ucloud/files
|
||||||
FILE_PREFIX = noclue-ahmed
|
FILE_PREFIX = noclue-ahmed
|
||||||
|
|
||||||
[ssh]
|
|
||||||
SSH_USERNAME =
|
|
||||||
SSH_PRIVATEKEY =
|
|
|
@ -5,18 +5,14 @@ from ucloud.common.request import RequestPool
|
||||||
from ucloud.common.vm import VmPool
|
from ucloud.common.vm import VmPool
|
||||||
from ucloud.common.storage_handlers import FileSystemBasedImageStorageHandler, CEPHBasedImageStorageHandler
|
from ucloud.common.storage_handlers import FileSystemBasedImageStorageHandler, CEPHBasedImageStorageHandler
|
||||||
|
|
||||||
from decouple import Config, RepositoryEnv, RepositoryEmpty
|
|
||||||
|
|
||||||
# Replacing decouple inline
|
# Replacing decouple inline
|
||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
log = logging.getLogger("ucloud.config")
|
log = logging.getLogger("ucloud.config")
|
||||||
|
|
||||||
|
|
||||||
conf_name = "ucloud.conf"
|
conf_name = "ucloud.conf"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -34,14 +30,6 @@ try:
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
log.warn("Configuration file not found - using defaults")
|
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_args = ()
|
||||||
etcd_wrapper_kwargs = {
|
etcd_wrapper_kwargs = {
|
||||||
'host': config['etcd']['ETCD_URL'],
|
'host': config['etcd']['ETCD_URL'],
|
||||||
|
|
|
@ -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):
|
||||||
|
@ -37,7 +37,7 @@ def setxattr(file, attr, value):
|
||||||
|
|
||||||
def sha512sum(file: str):
|
def sha512sum(file: str):
|
||||||
"""Use sha512sum utility to compute sha512 sum of arg:file
|
"""Use sha512sum utility to compute sha512 sum of arg:file
|
||||||
|
|
||||||
IF arg:file does not exists:
|
IF arg:file does not exists:
|
||||||
raise FileNotFoundError exception
|
raise FileNotFoundError exception
|
||||||
ELSE IF sum successfully computer:
|
ELSE IF sum successfully computer:
|
||||||
|
@ -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