Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exception in adding mirror_session when gre_type is absent (#2476)
What I did This PR is a duplication of https://github.com/sonic-net/sonic-utilities/pull/2458/files. 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.
- Loading branch information