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

[BUG] The naventity command crashes with an AttributeError #2433

Closed
lunkwill42 opened this issue Jun 23, 2022 · 1 comment · Fixed by #2444
Closed

[BUG] The naventity command crashes with an AttributeError #2433

lunkwill42 opened this issue Jun 23, 2022 · 1 comment · Fixed by #2444
Assignees
Labels

Comments

@lunkwill42
Copy link
Member

lunkwill42 commented Jun 23, 2022

Describe the bug

The naventity command (from the /bin/ directory) currently crashes with an AttributeError (and a long traceback) whenever it is run for an IP Device that supports the ENTITY-MIB. It is likely a result of the NetworkX library being upgraded to version 2.6.3 in NAV 5.3 earlier this year.

NetworkX is used by naventity to model a tree of entities before pretty-printing an ascii tree to stdout.

To Reproduce

  1. Run naventity <snmp-enabled-device-from-your-nav-installation>
  2. See error

Expected behavior

A tree of the ENTITY-MIB::entPhysicalTable hierarchy of the device should be displayed to the terminal.

Tracebacks

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/defer.py", line 1475, in gotResult
    _inlineCallbacks(r, g, status)
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/defer.py", line 1461, in _inlineCallbacks
    status.deferred.callback(e.value)
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/defer.py", line 460, in callback
    self._startRunCallbacks(result)
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/source/bin/naventity", line 96, in print_graph
    output = asciitree.LeftAligned(traverse=traversal)(root)
  File "/usr/local/lib/python3.9/dist-packages/asciitree/__init__.py", line 48, in __call__
    return '\n'.join(self.render(self.traverse.get_root(tree)))
  File "/usr/local/lib/python3.9/dist-packages/asciitree/__init__.py", line 27, in render
    lines.append(self.draw.node_label(self.traverse.get_text(node)))
  File "/source/bin/naventity", line 196, in get_text
    ent = self.graph.node[node]
builtins.AttributeError: 'DiGraph' object has no attribute 'node'

Environment (please complete the following information):

  • NAV version installed: 5.4.0
  • Method of installation: Debian / source code / git checkout - doesn't matter
@lunkwill42 lunkwill42 changed the title .[BUG] [BUG] The naventity command crashes with an AttributeError Jun 23, 2022
@lunkwill42 lunkwill42 added the bug label Jun 23, 2022
@lunkwill42
Copy link
Member Author

Suggestion: Implementation of a fix should start by writing a integration/regression test to reproduce the problem. snmpsim has been successfully used by some existing tests to imitate an SNMP agent, so one way to go about this is to dump the ENTITY-MIB::entPhysicalTable response from some device, sanitize/censor the data if necessary, and use this data for a simulated SNMP device.

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 a pull request may close this issue.

2 participants