From 924b33856a717a70570e9108596716a781e39ec0 Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Thu, 19 Jul 2018 18:25:12 +0300 Subject: Align normatives and scripts Change-Id: I5e15e3c5adaf13a5b785613d20411f5d0e42e264 Issue-ID: SDC-1544 Signed-off-by: Tal Gitelman --- .../scripts/import/tosca/importONAPNormativeAll.py | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py') diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py index 6144d69104..ef1fe4d3b9 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py @@ -37,19 +37,20 @@ def usage(): print sys.argv[0], '[-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' def handleResults(results, updateversion): - printFrameLine() - for result in results: - printNameAndReturnCode(result[0], result[1]) - printFrameLine() - - responseCodes = [200, 201] - - if(updateversion == 'false'): - responseCodes = [200, 201, 409] - - failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) - if (len(failedResults) > 0): - errorAndExit(1, None) + if results is not None: + print_frame_line() + for result in results: + print_name_and_return_code(result[0], result[1]) + print_frame_line() + + responseCodes = [200, 201] + + if(updateversion == 'false'): + responseCodes = [200, 201, 409] + + failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) + if (len(failedResults) > 0): + error_and_exit(1, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -66,7 +67,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -146,7 +147,7 @@ def main(argv): fileLocation = baseFileLocation + "policy-types/" importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[1:]) -- cgit 1.2.3-korg