better etcd inits
This commit is contained in:
parent
f3f2f6127a
commit
597dedb1ff
2 changed files with 8 additions and 5 deletions
|
@ -10,7 +10,13 @@ from decouple import Config, RepositoryEnv
|
||||||
env_vars = Config(RepositoryEnv('/etc/ucloud/ucloud.conf'))
|
env_vars = Config(RepositoryEnv('/etc/ucloud/ucloud.conf'))
|
||||||
|
|
||||||
etcd_wrapper_args = ()
|
etcd_wrapper_args = ()
|
||||||
etcd_wrapper_kwargs = {'host': env_vars.get('ETCD_URL')}
|
etcd_wrapper_kwargs = {
|
||||||
|
'host': env_vars.get('ETCD_URL', 'localhost'),
|
||||||
|
'port': env_vars.get('ETCD_PORT', 2379),
|
||||||
|
'ca_cert': env_vars.get('CA_CERT', None),
|
||||||
|
'cert_cert': env_vars.get('CERT_CERT', None),
|
||||||
|
'cert_key': env_vars.get('CERT_KEY', None)
|
||||||
|
}
|
||||||
|
|
||||||
etcd_client = Etcd3Wrapper(*etcd_wrapper_args, **etcd_wrapper_kwargs)
|
etcd_client = Etcd3Wrapper(*etcd_wrapper_args, **etcd_wrapper_kwargs)
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,8 @@ import subprocess as sp
|
||||||
import time
|
import time
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from etcd3_wrapper import Etcd3Wrapper
|
|
||||||
from filescanner import logger
|
from filescanner import logger
|
||||||
from config import env_vars
|
from config import env_vars, etcd_client
|
||||||
|
|
||||||
|
|
||||||
def getxattr(file, attr):
|
def getxattr(file, attr):
|
||||||
|
@ -74,8 +73,6 @@ def main():
|
||||||
|
|
||||||
FILE_PREFIX = env_vars.get("FILE_PREFIX")
|
FILE_PREFIX = env_vars.get("FILE_PREFIX")
|
||||||
|
|
||||||
etcd_client = Etcd3Wrapper(host=env_vars.get("ETCD_URL"))
|
|
||||||
|
|
||||||
# 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