@@ -357,7 +357,7 @@ def massage_install_data(data):
357357 return result_data
358358
359359
360- def build_install_cmd_set (issu , image , kick , type , force = True ):
360+ def build_install_cmd_set (issu , image , kick , epld , type , force = True ):
361361 commands = ["terminal dont-ask" ]
362362
363363 # Different NX-OS platforms behave differently for
@@ -389,7 +389,10 @@ def build_install_cmd_set(issu, image, kick, type, force=True):
389389 else :
390390 rootcmd = "install all"
391391 if kick is None :
392- commands .append ("%s nxos %s %s" % (rootcmd , image , issu_cmd ))
392+ if epld is None :
393+ commands .append ("%s nxos %s %s" % (rootcmd , image , issu_cmd ))
394+ else :
395+ commands .append ("%s nxos %s epld %s %s" % (rootcmd , image , epld , issu_cmd ))
393396 else :
394397 commands .append (
395398 "%s %s system %s kickstart %s" % (rootcmd , issu_cmd , image , kick ),
@@ -454,16 +457,16 @@ def check_mode_legacy(module, issu, image, kick=None):
454457 return data
455458
456459
457- def check_mode_nextgen (module , issu , image , kick = None ):
460+ def check_mode_nextgen (module , issu , image , kick = None , epld = None ):
458461 """Use the 'install all impact' command for check_mode"""
459462 opts = {"ignore_timeout" : True }
460- commands = build_install_cmd_set (issu , image , kick , "impact" )
463+ commands = build_install_cmd_set (issu , image , kick , epld , "impact" )
461464 data = parse_show_install (load_config (module , commands , True , opts ))
462465 # If an error is encountered when issu is 'desired' then try again
463466 # but set issu to 'no'
464467 if data ["error" ] and issu == "desired" :
465468 issu = "no"
466- commands = build_install_cmd_set (issu , image , kick , "impact" )
469+ commands = build_install_cmd_set (issu , image , kick , epld , "impact" )
467470 # The system may be busy from the previous call to check_mode so loop
468471 # until it's done.
469472 data = check_install_in_progress (module , commands , opts )
@@ -499,7 +502,7 @@ def check_mode(module, issu, image, kick=None):
499502 return data
500503
501504
502- def do_install_all (module , issu , image , kick = None ):
505+ def do_install_all (module , issu , image , kick = None , epld = None ):
503506 """Perform the switch upgrade using the 'install all' command"""
504507 impact_data = check_mode (module , issu , image , kick )
505508 if module .check_mode :
@@ -526,15 +529,15 @@ def do_install_all(module, issu, image, kick=None):
526529 else :
527530 issu = "no"
528531
529- commands = build_install_cmd_set (issu , image , kick , "install" )
532+ commands = build_install_cmd_set (issu , image , kick , epld , "install" )
530533 opts = {"ignore_timeout" : True }
531534 # The system may be busy from the call to check_mode so loop until
532535 # it's done.
533536 upgrade = check_install_in_progress (module , commands , opts )
534537 if upgrade ["invalid_command" ] and "force" in commands [1 ]:
535538 # Not all platforms support the 'force' keyword. Check for this
536539 # condition and re-try without the 'force' keyword if needed.
537- commands = build_install_cmd_set (issu , image , kick , "install" , False )
540+ commands = build_install_cmd_set (issu , image , kick , epld , "install" , False )
538541 upgrade = check_install_in_progress (module , commands , opts )
539542 upgrade ["upgrade_cmd" ] = commands
540543
@@ -563,6 +566,7 @@ def main():
563566 argument_spec = dict (
564567 system_image_file = dict (required = True ),
565568 kickstart_image_file = dict (required = False ),
569+ epld_image_file = dict (required = False ),
566570 issu = dict (choices = ["required" , "desired" , "no" , "yes" ], default = "no" ),
567571 )
568572
@@ -574,6 +578,7 @@ def main():
574578 # issu settings from module params.
575579 sif = module .params ["system_image_file" ]
576580 kif = module .params ["kickstart_image_file" ]
581+ eif = module .params ["epld_image_file" ]
577582 issu = module .params ["issu" ]
578583
579584 if re .search (r"(yes|required)" , issu ):
@@ -582,7 +587,10 @@ def main():
582587 if kif == "null" or kif == "" :
583588 kif = None
584589
585- install_result = do_install_all (module , issu , sif , kick = kif )
590+ if eif == "null" or eif == "" :
591+ eif = None
592+
593+ install_result = do_install_all (module , issu , sif , kick = kif , epld = eif )
586594 if install_result ["error" ]:
587595 cmd = install_result ["upgrade_cmd" ]
588596 msg = "Failed to upgrade device using command: %s" % cmd
0 commit comments