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

Fix exception in adding mirror_session when gre_type is absent #2458

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

bingwang-ms
Copy link
Contributor

What I did

This PR is to fix the exception in adding mirror session when gre_type is absent.

~$ sudo config mirror_session add session_1 25.25.25.25 10.1.1.1 8 100
Traceback (most recent call last):
  File "/usr/local/bin/config", line 8, in <module>
    sys.exit(config())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1135, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 641, in make_context
    self.parse_args(ctx, args)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 940, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1476, in handle_parse_result
    value = invoke_param_callback(
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 96, in invoke_param_callback
    return callback(ctx, param, value)
  File "/usr/local/lib/python3.9/dist-packages/config/main.py", line 1069, in validate_gre_type
    if value.lower().startswith('0x'):
AttributeError: 'NoneType' object has no attribute 'lower'

How I did it

Add a check in validate_gre_type. If gre_type is absent, return None directly.

How to verify it

Verified by UT and running on a testbed.

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

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

@bingwang-ms
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@bingwang-ms bingwang-ms merged commit 4a3d49d into sonic-net:master Oct 27, 2022
dprital added a commit to dprital/sonic-buildimage that referenced this pull request Oct 28, 2022
Update sonic-utilities submodule pointer to include the following:
* 4a3d49d Fix exception in adding mirror_session when gre_type is absent ([sonic-net#2458](sonic-net/sonic-utilities#2458))
* 7e7d05c Update the DBmigrator to support persistent loglevel during warm-upgrade ([sonic-net#2370](sonic-net/sonic-utilities#2370))
* c2841b8 [doc]: Update Command-Reference.md ([sonic-net#2444](sonic-net/sonic-utilities#2444))
* 254cafc Event Counters CLI ([sonic-net#2449](sonic-net/sonic-utilities#2449))
* 2dab0d0 [techsupport] Adding FRR EVPN dumps ([sonic-net#2442](sonic-net/sonic-utilities#2442))
* 3c0aece [show][muxcable] add support for show mux firmware version all ([sonic-net#2441](sonic-net/sonic-utilities#2441))

Signed-off-by: dprital <drorp@nvidia.com>
@yxieca
Copy link
Contributor

yxieca commented Nov 3, 2022

@bingwang-ms can you create a separate PR for 202205 branch?

@bingwang-ms
Copy link
Contributor Author

@bingwang-ms can you create a separate PR for 202205 branch?

Sure, open another PR for 202205 #2476

LGH-12 added a commit to LGH-12/sonic-utilities that referenced this pull request Nov 14, 2022
Signed-off-by: LTeng <liuteng@asterfusion.com>
preetham-singh pushed a commit to preetham-singh/sonic-utilities that referenced this pull request Nov 21, 2022
…-net#2458)

This PR is to fix the exception in adding mirror session when gre_type is absent.
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.

3 participants