diff options
Diffstat (limited to 'catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py')
-rw-r--r-- | catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py index 6d90a1c085..47acd05f5f 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py +++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py @@ -1,35 +1,21 @@ #!/usr/bin/env python3 import os -import sys from sdcBePy.common import logger -from sdcBePy.common.logger import error_and_exit +from sdcBePy.common.logger import print_and_exit from sdcBePy.common.normative.main import process_element_list, process_type_list -from sdcBePy.common.sdcBeProxy import SdcBeProxy -from sdcBePy.tosca.main import get_args, usage +from sdcBePy.tosca.main import parse_and_create_proxy from sdcBePy.tosca.models.normativeElementsList import get_normative_element_candidate_list, \ get_normative_element_with_metadata_list from sdcBePy.tosca.models.normativeToUpdateList import TypesToUpdate, get_heat_and_normative_to_update_list, \ get_nfv_onap_sol_to_update_list -def main(): - scheme, be_host, be_port, admin_user, _, debug = get_args() - +def main(sdc_be_proxy): update_version = True update_onap_version = False - 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) - # use to run script form this dir (not like the command) # base_file_location = os.getcwd() + "/../../../../import/tosca/" base_file_location = os.getcwd() + "/" @@ -46,7 +32,7 @@ def main(): process_type_list(nfv_onap_sol_list, sdc_be_proxy, update_onap_version) logger.log("Updating end ->", "All normatives updated successfully!") - error_and_exit(0, None) + print_and_exit(0, None) def get_all_types(): @@ -55,5 +41,10 @@ def get_all_types(): path + "/../data/onapTypesToUpgrade.json"]) +def run(): + sdc_be_proxy, _ = parse_and_create_proxy() + main(sdc_be_proxy) + + if __name__ == "__main__": - main() + run() |