Allow non existing configuration file

Fixes #1.
This commit is contained in:
Nico Schottelius 2019-12-07 13:45:01 +01:00
parent 34d9dc1f73
commit 40176d2eaf
3 changed files with 15 additions and 4 deletions

8
.gitignore vendored
View file

@ -1,12 +1,18 @@
.idea .idea
.vscode .vscode
__pycache__
ucloud/docs/build ucloud/docs/build
logs.txt logs.txt
ucloud.egg-info ucloud.egg-info
# run artefacts
default.etcd default.etcd
__pycache__
# build artefacts
ucloud/version.py ucloud/version.py
build/
venv/
dist/

View file

@ -4,7 +4,7 @@ with open("README.md", "r") as fh:
long_description = fh.read() long_description = fh.read()
setup(name='ucloud', setup(name='ucloud',
version='0.1', version='0.0.1',
description='All ucloud server components.', description='All ucloud server components.',
url='https://code.ungleich.ch/ucloud/ucloud', url='https://code.ungleich.ch/ucloud/ucloud',
long_description=long_description, long_description=long_description,

View file

@ -4,10 +4,15 @@ from ucloud.common.host import HostPool
from ucloud.common.request import RequestPool 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 from decouple import Config, RepositoryEnv, RepositoryEmpty
env_vars = Config(RepositoryEnv('/etc/ucloud/ucloud.conf')) # 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 = {