diff options
author | k.kedron <k.kedron@partner.samsung.com> | 2020-06-05 14:51:01 +0200 |
---|---|---|
committer | Krystian Kedron <k.kedron@partner.samsung.com> | 2020-06-24 09:21:00 +0000 |
commit | 16fe29ac226610f79c8da1f691437ec7fe6e79c4 (patch) | |
tree | 5b73d8f1724c561609c05fd2802ad80b7acfb4c0 /catalog-be/src/main/resources/scripts/sdcBePy/common/healthCheck.py | |
parent | fca8a0b1af32083b8ea025135b120091aec9714f (diff) |
Improvement sdc-BE-init python scripts
- Implemented retries when request fail
- Moved configuration variables to the Properties file
- Extended sdcBeProxy
- Implemented script to run import/update (should fix deployment glitch)
- Updated the import_Normatives recipes to use new script
Issue-ID: SDC-2784
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: I83fab898783ad8d3b3d532af43d75bc54d033c33
Diffstat (limited to 'catalog-be/src/main/resources/scripts/sdcBePy/common/healthCheck.py')
-rw-r--r-- | catalog-be/src/main/resources/scripts/sdcBePy/common/healthCheck.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/common/healthCheck.py b/catalog-be/src/main/resources/scripts/sdcBePy/common/healthCheck.py index 7d8558d644..c99db5b434 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/common/healthCheck.py +++ b/catalog-be/src/main/resources/scripts/sdcBePy/common/healthCheck.py @@ -4,14 +4,13 @@ import time from argparse import ArgumentParser from datetime import datetime +from sdcBePy import properties from sdcBePy.common.bColors import BColors +from sdcBePy.common.properties import init_properties from sdcBePy.common.sdcBeProxy import SdcBeProxy colors = BColors() -RETRY_TIME = 10 -RETRY_ATTEMPTS = 10 - def check_backend(sdc_be_proxy=None, reply_append_count=1, be_host=None, be_port=None, scheme=None, debug=False): if sdc_be_proxy is None: @@ -24,13 +23,14 @@ def check_backend(sdc_be_proxy=None, reply_append_count=1, be_host=None, be_port else: print('[WARRING]: ' + datetime.now().strftime('%Y/%m/%d %H:%M:%S') + colors.FAIL + ' Backend not responding, try #' + str(i) + colors.END_C) - time.sleep(RETRY_TIME) + time.sleep(properties.retry_time) return False def run(be_host, be_port, protocol): - if not check_backend(reply_append_count=RETRY_ATTEMPTS, be_host=be_host, be_port=be_port, scheme=protocol): + if not check_backend(reply_append_count=properties.retry_attempts, be_host=be_host, + be_port=be_port, scheme=protocol): print('[ERROR]: ' + time.strftime('%Y/%m/%d %H:%M:%S') + colors.FAIL + ' Backend is DOWN :-(' + colors.END_C) sys.exit() @@ -44,6 +44,7 @@ def get_args(): args = parser.parse_args() + init_properties(10, 10) return [args.ip, args.port, 'https' if args.https else 'http'] |