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 not working: 'generator' object has no attribute '__getitem__' #252

Closed
teomcpy opened this Issue Mar 2, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@teomcpy

teomcpy commented Mar 2, 2016

ubuntu@ubuntu-VirtualBox:~/MyFiles$ netdev -l 172.16.1.2
    Hostname:          172.16.1.2
    Owning Org.:       Cisco Network Dept.
    Owning Team:       Data Center
    OnCall Team:       Data Center

ubuntu@ubuntu-VirtualBox:~/$ssh mihai@172.16.1.2
Password: 

Cisco-R1#

ubuntu@ubuntu-VirtualBox:~/MyFiles$gnng 172.16.1.2
Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1087, in connectionLost
    self.factory.clientConnectionLost(self, reason)
  File "/usr/local/lib/python2.7/dist-packages/trigger/twister.py", line 737, in clientConnectionLost
    self.d.callback(self.results)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 393, in callback
    self._startRunCallbacks(result)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 501, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/trigger/cmds.py", line 476, in parse
    return func(results, device, commands)
  File "/usr/local/lib/python2.7/dist-packages/trigger/cmds.py", line 846, in from_cisco
    alld = data[0]
exceptions.TypeError: 'generator' object has no attribute '__getitem__'

@jathanism jathanism added the bug label Mar 2, 2016

@jathanism

This comment has been minimized.

Member

jathanism commented Mar 3, 2016

Looks like this is related to the new "TextFSM" support in Trigger 1.5.7. Oops.

@tcuthbert

This comment has been minimized.

Contributor

tcuthbert commented Mar 3, 2016

This issue is due the results bucket being filled with both the textfsm generator objects and raw data. We need the parse function to filter out these generator objects.

Leave it with me!

tcuthbert added a commit to tcuthbert/trigger that referenced this issue Mar 6, 2016

Resolve Trigger Issue trigger#252
Instead of yielding fallback results which causes return data to come back as a generator, append them to a list and return all results at the end of a run. This ensures all external calls to the results object function the same as before.

tcuthbert added a commit to tcuthbert/trigger that referenced this issue Mar 9, 2016

Updated Patch for trigger#252
* Moved TextFSM vendor mapping functionality into the NetDevices object.
The NetDevices object now has an "os" attribute.

* Added more tests including a test for the template parser.

jathanism added a commit that referenced this issue Mar 9, 2016

Merge pull request #255 from tcuthbert/#252
Resolve Trigger Issue #252
@tcuthbert

This comment has been minimized.

Contributor

tcuthbert commented Mar 9, 2016

This should be fixed by #255

@teomcpy Can you test and confirm?

@jathanism jathanism closed this Mar 9, 2016

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