Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[show][muxcable] fix show mux hwmode muxdirection RC #2812

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions show/muxcable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,13 +1394,14 @@ def muxdirection(db, port, json_output):
headers = ['Port', 'Direction', 'Presence']
click.echo(tabulate(body, headers=headers))

return rc
rc_exit = EXIT_SUCCESS if rc==0 else EXIT_FAIL
sys.exit(rc_exit)

else:

logical_port_list = platform_sfputil_helper.get_logical_list()

rc_exit = True
rc_exit = EXIT_SUCCESS
body = []
active_active = False
if json_output:
Expand Down Expand Up @@ -1449,8 +1450,9 @@ def muxdirection(db, port, json_output):
active_active = True
else:
rc = create_active_standby_mux_direction_result(body, port, db)
if rc != 0:
rc_exit = False

if rc != 0:
rc_exit = EXIT_FAIL



Expand All @@ -1464,8 +1466,7 @@ def muxdirection(db, port, json_output):
headers = ['Port', 'Direction', 'Presence']
click.echo(tabulate(body, headers=headers))

if rc_exit == False:
sys.exit(EXIT_FAIL)
sys.exit(rc_exit)


@hwmode.command()
Expand Down Expand Up @@ -2140,7 +2141,7 @@ def get_grpc_cached_version_mux_direction_per_port(db, port):
mux_info_dict = {}
mux_info_full_dict = {}
trans_info_full_dict = {}
mux_info_dict["rc"] = False
mux_info_dict["rc"] = 1

# Getting all front asic namespace and correspding config and state DB connector

Expand Down Expand Up @@ -2182,7 +2183,7 @@ def get_grpc_cached_version_mux_direction_per_port(db, port):

mux_info_dict["presence"] = presence

mux_info_dict["rc"] = True
mux_info_dict["rc"] = 0

return mux_info_dict

Expand Down Expand Up @@ -2222,14 +2223,15 @@ def muxdirection(db, port, json_output):
rc = create_active_active_mux_direction_result(body, port, db)
click.echo(tabulate(body, headers=headers))

return rc
rc_exit = EXIT_SUCCESS if rc==0 else EXIT_FAIL
sys.exit(rc_exit)

else:


logical_port_list = platform_sfputil_helper.get_logical_list()

rc_exit = True
rc_exit = EXIT_SUCCESS
body = []
if json_output:
result = {}
Expand Down Expand Up @@ -2266,8 +2268,8 @@ def muxdirection(db, port, json_output):
else:
rc = create_active_active_mux_direction_result(body, port, db)

if rc != True:
rc_exit = False
if rc != 0:
rc_exit = EXIT_FAIL

if json_output:
click.echo("{}".format(json.dumps(result, indent=4)))
Expand All @@ -2276,8 +2278,7 @@ def muxdirection(db, port, json_output):

click.echo(tabulate(body, headers=headers))

if rc_exit == False:
sys.exit(EXIT_FAIL)
sys.exit(rc_exit)

@muxcable.command()
@click.argument('port', metavar='<port_name>', required=True, default=None)
Expand Down