From 597dedb1ff24b0c12a22750ae43f77585f625383 Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 27 Nov 2019 15:35:51 +0500 Subject: [PATCH 1/2] better etcd inits --- config.py | 8 +++++++- filescanner/main.py | 5 +---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 1048320..c58cf33 100644 --- a/config.py +++ b/config.py @@ -10,7 +10,13 @@ from decouple import Config, RepositoryEnv env_vars = Config(RepositoryEnv('/etc/ucloud/ucloud.conf')) 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) diff --git a/filescanner/main.py b/filescanner/main.py index b80169c..385d31d 100755 --- a/filescanner/main.py +++ b/filescanner/main.py @@ -5,9 +5,8 @@ import subprocess as sp import time from uuid import uuid4 -from etcd3_wrapper import Etcd3Wrapper from filescanner import logger -from config import env_vars +from config import env_vars, etcd_client def getxattr(file, attr): @@ -74,8 +73,6 @@ def main(): 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 files = glob.glob("{}/**".format(BASE_DIR), recursive=True) From fd042eb85d16319a706d375be554a0143c46a4b5 Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 27 Nov 2019 15:38:26 +0500 Subject: [PATCH 2/2] default.etcd removed from .gitignore as it is alpine only issue that forces us to use start-stop-daemon to start etcd cluster which uses the cur dir for storing data --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7764afb..55adfaf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,4 @@ __pycache__ docs/build -logs.txt - -default.etcd +logs.txt \ No newline at end of file