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

`gnng` should support partial hostname lookups like `gong` does #89

Closed
jathanism opened this Issue Jun 14, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@jathanism
Member

jathanism commented Jun 14, 2013

This should not happen:

% gnng device
Traceback (most recent call last):
  File "/opt/bin/gnng", line 454, in <module>
    main()
  File "/opt/bin/gnng", line 438, in main
    routers = fetch_router_list(args[1:])
  File "/opt/bin/gnng", line 91, in fetch_router_list
    if not pass_filters(nd.find(arg)):
  File "/opt/lib/python2.7/site-packages/trigger/netdevices/__init__.py", line 718, in find
    raise KeyError(key)
KeyError: 'device'
@supertylerc

This comment has been minimized.

Contributor

supertylerc commented Apr 18, 2016

Is #278 actually a duplicate? This issue seems to be for partial hostname lookups (which is already a thing) whereas #278 is for a graceful failure if the device just doesn't exist.

@jathanism

This comment has been minimized.

Member

jathanism commented Apr 18, 2016

Ah sorry, so it's the same underlying machinery. It's the "look up a device and if it's not found either fail gracefully or try to present a list of closest matches" problem.

@supertylerc

This comment has been minimized.

Contributor

supertylerc commented Apr 18, 2016

Thanks. I think I have a fix. Looks like this now:

$ gnng 10.254.254.2 10.254.254.3
Device not found: 10.254.254.3
DEVICE: 10.254.254.2
Interface       | Addresses    | Subnets         | ACLs IN | ACLs OUT | Description
-----------------------------------------------------------------------------------
    Ethernet0/0 | 10.254.254.2 | 10.254.254.0/24 |         |          |  harbl
$

supertylerc added a commit to supertylerc/trigger that referenced this issue Apr 18, 2016

Gracefully skip devices that can't be found
Catch the `KeyError` exception from `NetDevices.find()` so that we don't
bubble it up to the end user.  Allows us to continue with any other
valid devices while pointing out that the invalid ones couldn't be
found.

Fixes trigger#89.

supertylerc added a commit to supertylerc/trigger that referenced this issue Apr 18, 2016

Gracefully skip devices that can't be found
Use `trigger.netdevices.device_match()` to find the right device.
Allows us to continue with any other valid devices while pointing
out that the invalid ones couldn't be found.

Fixes trigger#89.

jathanism added a commit that referenced this issue Apr 18, 2016

Gracefully skip devices that can't be found (#279)
Use `trigger.netdevices.device_match()` to find the right device.
Allows us to continue with any other valid devices while pointing
out that the invalid ones couldn't be found.

Fixes #89.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment