Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
JunhongMao committed May 9, 2024
1 parent b34fd06 commit 711c617
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/chassis_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def get_config_module_state(db, chassis_module_name):


#
# Name: get_config_module_state_timeout
# Name: check_config_module_state_with_timeout
# return: True: timeout, False: not timeout
#
def get_config_module_state_timeout(ctx, db, chassis_module_name, state):
def check_config_module_state_with_timeout(ctx, db, chassis_module_name, state):
counter = 0
while get_config_module_state(db, chassis_module_name) != state:
time.sleep(1)
Expand Down Expand Up @@ -114,7 +114,7 @@ def shutdown_chassis_module(db, chassis_module_name):
fvs = {'admin_status': 'down'}
config_db.set_entry('CHASSIS_MODULE', chassis_module_name, fvs)
if chassis_module_name.startswith("FABRIC-CARD"):
if not get_config_module_state_timeout(ctx, db, chassis_module_name, 'down'):
if not check_config_module_state_with_timeout(ctx, db, chassis_module_name, 'down'):
fabric_module_set_admin_status(db, chassis_module_name, 'down')

#
Expand All @@ -136,5 +136,5 @@ def startup_chassis_module(db, chassis_module_name):
click.echo("Starting up chassis module {}".format(chassis_module_name))
config_db.set_entry('CHASSIS_MODULE', chassis_module_name, None)
if chassis_module_name.startswith("FABRIC-CARD"):
if not get_config_module_state_timeout(ctx, db, chassis_module_name, 'up'):
if not check_config_module_state_with_timeout(ctx, db, chassis_module_name, 'up'):
fabric_module_set_admin_status(db, chassis_module_name, 'up')

0 comments on commit 711c617

Please sign in to comment.