aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/resources/scripts/sdcBePy/tosca/main.py
diff options
context:
space:
mode:
authork.kedron <k.kedron@partner.samsung.com>2020-06-05 14:51:01 +0200
committerKrystian Kedron <k.kedron@partner.samsung.com>2020-06-24 09:21:00 +0000
commit16fe29ac226610f79c8da1f691437ec7fe6e79c4 (patch)
tree5b73d8f1724c561609c05fd2802ad80b7acfb4c0 /catalog-be/src/main/resources/scripts/sdcBePy/tosca/main.py
parentfca8a0b1af32083b8ea025135b120091aec9714f (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/tosca/main.py')
-rw-r--r--catalog-be/src/main/resources/scripts/sdcBePy/tosca/main.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/main.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/main.py
index 2535ba6d77..565ce7efdb 100644
--- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/main.py
+++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/main.py
@@ -3,6 +3,10 @@ import os
import sys
from argparse import ArgumentParser
+from sdcBePy.common import logger
+from sdcBePy.common.properties import init_properties
+from sdcBePy.common.sdcBeProxy import SdcBeProxy
+
def usage():
print(sys.argv[0],
@@ -53,4 +57,22 @@ def get_args():
print('scheme =', scheme, ',be host =', be_host, ', be port =', be_port, ', user =', admin_user,
', debug =', debug, ', update_version =', update_version)
+ init_properties(defaults["retryTime"], defaults["retryAttempt"], defaults["resourceLen"])
return scheme, be_host, be_port, admin_user, update_version, debug
+
+
+def parse_and_create_proxy():
+ scheme, be_host, be_port, admin_user, update_version, debug = get_args()
+
+ if debug is False:
+ print('Disabling debug mode')
+ logger.debugFlag = debug
+
+ try:
+ sdc_be_proxy = SdcBeProxy(be_host, be_port, scheme, admin_user, debug=debug)
+ except AttributeError:
+ usage()
+ sys.exit(3)
+
+ return sdc_be_proxy, update_version
+