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

teomcpy opened this Issue Mar 2, 2016 · 3 comments


None yet
3 participants

teomcpy commented Mar 2, 2016

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

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


Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/internet/", line 1087, in connectionLost
    self.factory.clientConnectionLost(self, reason)
  File "/usr/local/lib/python2.7/dist-packages/trigger/", line 737, in clientConnectionLost
  File "/usr/lib/python2.7/dist-packages/twisted/internet/", line 393, in callback
  File "/usr/lib/python2.7/dist-packages/twisted/internet/", line 501, in _startRunCallbacks
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/trigger/", line 476, in parse
    return func(results, device, commands)
  File "/usr/local/lib/python2.7/dist-packages/trigger/", 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


This comment has been minimized.


jathanism commented Mar 3, 2016

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


This comment has been minimized.


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

This comment has been minimized.


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