Skip to content

[show] Add missing import to fix show ip interfaces#1126

Merged
jleveque merged 1 commit intosonic-net:masterfrom
lolyu:fix_show_ip_interface
Sep 23, 2020
Merged

[show] Add missing import to fix show ip interfaces#1126
jleveque merged 1 commit intosonic-net:masterfrom
lolyu:fix_show_ip_interface

Conversation

@lolyu
Copy link
Contributor

@lolyu lolyu commented Sep 22, 2020

Add the missing import of netaddr for show ip interfaces.

Signed-off-by: Longxiang Lyu lolv@microsoft.com

- What I did

- How I did it

- How to verify it

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

$ show ip interfaces
Traceback (most recent call last):
  File "/usr/bin/show", line 12, in <module>
    sys.exit(cli())
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/show/main.py", line 727, in interfaces
    netmask = netaddr.IPAddress(ipaddr['netmask']).netmask_bits()
NameError: global name 'netaddr' is not defined

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

$ show ip interfaces
Interface    Master    IPv4 address/mask    Admin/Oper    BGP Neighbor    Neighbor IP
-----------  --------  -------------------  ------------  --------------  -------------
Ethernet0              192.168.1.2/24       up/down       N/A             N/A
Ethernet28             192.168.4.1/24       up/up         N/A             N/A
docker0                240.127.1.1/24       up/down       N/A             N/A
eth0                   10.3.146.241/23      up/up         N/A             N/A
lo                     127.0.0.1/16         up/up         N/A             N/A

Add the missing import of `netaddr` for `show ip interfaces`.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
@lolyu lolyu force-pushed the fix_show_ip_interface branch from 3ca202a to afb7f61 Compare September 22, 2020 08:30
@lolyu lolyu added the Bug label Sep 22, 2020
@lguohan lguohan requested a review from jleveque September 22, 2020 15:35
@jleveque
Copy link
Contributor

Retest this please

4 similar comments
@jleveque
Copy link
Contributor

Retest this please

@jleveque
Copy link
Contributor

Retest this please

@jleveque
Copy link
Contributor

Retest this please

@jleveque
Copy link
Contributor

Retest this please

@neethajohn
Copy link
Contributor

same as #1129

@jleveque jleveque changed the title [show] Add missing import [show] Add missing import to fix show ip interfaces Sep 23, 2020
@jleveque jleveque mentioned this pull request Sep 23, 2020
@jleveque
Copy link
Contributor

jleveque commented Sep 23, 2020

@neethajohn: Thanks for pointing out that duplicate PR. I just closed #1129 as a duplicate of this PR, because 1.) This PR was opened first, and 2.) In this PR, the import is added in alphabetical order. We will merged this PR.

@jleveque jleveque merged commit 2f79ac1 into sonic-net:master Sep 23, 2020
@lolyu lolyu deleted the fix_show_ip_interface branch September 24, 2020 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants