Skip to content

[202205][show]Fix show route return code on error#2547

Merged
yxieca merged 4 commits intosonic-net:202205from
dgsudharsan:ip_route_2205
Dec 13, 2022
Merged

[202205][show]Fix show route return code on error#2547
yxieca merged 4 commits intosonic-net:202205from
dgsudharsan:ip_route_2205

Conversation

@dgsudharsan
Copy link
Collaborator

Porting of changes #2542 to 202205

What I did

Fix show route return command to return error code on failure cases. The parameter return_cmd=True in run_command will suppress the return code and return success even in error scenarios.

How I did it

When run command is called with return_cmd = True, modified its return to include return code, which can then be used to assess if there is an error by the caller

How to verify it

Added UT to verify it

Previous command output (if the output of a command-line utility has changed)

root@sonic:/home/admin# show ip route 123
% Unknown command: show ip route 123 

root@sonic:/home/admin# echo $?
0

New command output (if the output of a command-line utility has changed)

root@sonic:/home/admin# show ip route 123
% Unknown command: show ip route 123 

root@sonic:/home/admin# echo $?
1

@dgsudharsan
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

/azp run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yxieca
Copy link
Contributor

yxieca commented Dec 13, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yxieca yxieca merged commit 25d581e into sonic-net:202205 Dec 13, 2022
@dgsudharsan dgsudharsan deleted the ip_route_2205 branch March 9, 2023 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants