@@ -919,9 +919,9 @@ def is_firstver_gt_secondver(first_ver, second_ver):
919919 return result
920920
921921
922- class syntheticMaintPValidate :
922+ class AciResult :
923923 """
924- APIC uses an object called `syntheticMaintPValidate ` to store the results of
924+ APIC uses an object called `AciResult ` to store the results of
925925 each rule/check in the pre-upgrade validation which is run during the upgrade
926926 workflow in the APIC GUI. When this script is invoked during the workflow, it
927927 is expected to write the results of each rule/check to a JSON file (one per rule)
@@ -1055,7 +1055,7 @@ def wrapper(index, total_checks, *args, **kwargs):
10551055 # both show the original check func name and `wrapper.__name__` can
10561056 # be dynamically changed inside each check func if needed. (mainly
10571057 # for test or debugging)
1058- synth = syntheticMaintPValidate (wrapper .__name__ , check_title , "" )
1058+ synth = AciResult (wrapper .__name__ , check_title , "" )
10591059 synth .updateWithResults (** r .as_dict_for_json_result ())
10601060 synth .writeResult ()
10611061 return r .result
@@ -5216,22 +5216,24 @@ def parse_args(args):
52165216 parser = ArgumentParser (description = "ACI Pre-Upgrade Validation Script - %s" % SCRIPT_VERSION )
52175217 parser .add_argument ("-t" , "--tversion" , action = "store" , type = str , help = "Upgrade Target Version. Ex. 6.2(1a)" )
52185218 parser .add_argument ("-c" , "--cversion" , action = "store" , type = str , help = "Override Current Version. Ex. 6.1(1a)" )
5219- parser .add_argument ("-d" , "--debug_function" , action = "store" , type = str , help = "Name of a single function to debug. Ex. 'apic_version_md5_check'" )
5220- parser .add_argument ("--puv" , action = "store_true" , help = "For built-in PUV. API Checks only. Checks using SSH are skipped." )
5219+ parser .add_argument ("-d" , "--debug-function" , action = "store" , type = str , help = "Name of a single function to debug. Ex. 'apic_version_md5_check'" )
5220+ parser .add_argument ("--api-only" , action = "store_true" , help = "For built-in PUV. API Checks only. Checks using SSH are skipped." )
5221+ parser .add_argument ("--no-cleanup" , action = "store_true" , help = "Skip all file cleanup after script execution." )
52215222 parsed_args = parser .parse_args (args )
5222- is_puv = parsed_args .puv
5223+ api_only = parsed_args .api_only
52235224 tversion = parsed_args .tversion
52245225 cversion = parsed_args .cversion
52255226 debug_function = parsed_args .debug_function
5226- return is_puv , tversion , cversion , debug_function
5227+ no_cleanup = parsed_args .no_cleanup
5228+ return api_only , tversion , cversion , debug_function , no_cleanup
52275229
52285230
5229- def prepare (is_puv , arg_tversion , arg_cversion , total_checks ):
5231+ def prepare (api_only , arg_tversion , arg_cversion , total_checks ):
52305232 prints (' ==== %s%s, Script Version %s ====\n ' % (ts , tz , SCRIPT_VERSION ))
52315233 prints ('!!!! Check https://github.com/datacenter/ACI-Pre-Upgrade-Validation-Script for Latest Release !!!!\n ' )
52325234
52335235 username = password = None
5234- if not is_puv :
5236+ if not api_only :
52355237 username , password = get_credentials ()
52365238 try :
52375239 cversion = get_current_version (arg_cversion )
@@ -5254,15 +5256,15 @@ def prepare(is_puv, arg_tversion, arg_cversion, total_checks):
52545256 "cversion" : str (cversion ),
52555257 "tversion" : str (tversion ),
52565258 "sw_cversion" : str (sw_cversion ),
5257- "is_puv " : is_puv ,
5259+ "api_only " : api_only ,
52585260 "total_checks" : total_checks ,
52595261 }
52605262 with open (META_FILE , "w" ) as f :
52615263 json .dump (metadata , f , indent = 2 )
52625264 return inputs
52635265
52645266
5265- def get_checks (is_puv , debug_func ):
5267+ def get_checks (api_only , debug_func ):
52665268 api_checks = [
52675269 # General Checks
52685270 target_version_compatibility_check ,
@@ -5368,7 +5370,7 @@ def get_checks(is_puv, debug_func):
53685370 ]
53695371 if debug_func :
53705372 return [check for check in api_checks + conn_checks if check .__name__ == debug_func ]
5371- if is_puv :
5373+ if api_only :
53725374 return api_checks
53735375 return conn_checks + api_checks
53745376
@@ -5394,7 +5396,7 @@ def run_checks(checks, inputs):
53945396 json .dump (summary , f , indent = 2 )
53955397
53965398
5397- def wrapup (is_puv ):
5399+ def wrapup (no_cleanup ):
53985400 subprocess .check_output (['tar' , '-czf' , BUNDLE_NAME , DIR ])
53995401 bundle_loc = '/' .join ([os .getcwd (), BUNDLE_NAME ])
54005402 prints ("""
@@ -5409,16 +5411,16 @@ def wrapup(is_puv):
54095411 prints ('==== Script Version %s FIN ====' % (SCRIPT_VERSION ))
54105412
54115413 # puv integration needs to keep reading files from `JSON_DIR` under `DIR`.
5412- if not is_puv and os .path .isdir (DIR ):
5414+ if not no_cleanup and os .path .isdir (DIR ):
54135415 shutil .rmtree (DIR )
54145416
54155417
54165418def main (args = None ):
5417- is_puv , arg_tversion , arg_cversion , debug_func = parse_args (args )
5418- checks = get_checks (is_puv , debug_func )
5419- inputs = prepare (is_puv , arg_tversion , arg_cversion , len (checks ))
5419+ api_only , arg_tversion , arg_cversion , debug_func , no_cleanup = parse_args (args )
5420+ checks = get_checks (api_only , debug_func )
5421+ inputs = prepare (api_only , arg_tversion , arg_cversion , len (checks ))
54205422 run_checks (checks , inputs )
5421- wrapup (is_puv )
5423+ wrapup (no_cleanup )
54225424
54235425
54245426if __name__ == "__main__" :
0 commit comments