Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[show] fix
show version
(sonic-net#1686)
#### What I did Fix `NameError` from `show version`. ``` admin@str2-7050cx3-acs-02:~$ show version Traceback (most recent call last): File "/usr/local/bin/show", line 8, in <module> sys.exit(cli()) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/show/main.py", line 960, in version chassis_info = platform.get_chassis_info() File "/usr/local/lib/python3.7/dist-packages/show/platform.py", line 27, in get_chassis_info platform_chassis = sonic_platform.platform.Platform().get_chassis() NameError: name 'sonic_platform' is not defined ``` #### How I did it Import `sonic_platform` before using `sonic_platform`. Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
- Loading branch information