ansible/ansible — pull request #1898 by silviud (2013-01-23 16:52:13+00:00)
Title: Inventory class - lambda fails on attribute access - g.name is a string not the group obje...

Looks like there is a small bug into the Inventory.list_groups function.

```
locals()
{'group': , 'i': , '__builtins__': , 'inv': , '__package__': None, 'Runner': , 'hosts': ['127.0.0.1', 'ec2-somehosts'], 'Inventory': , '__name__': '__main__', '__doc__': None}
type(inv)

inv.groups
[]
inv.list_groups
>
inv.list_groups()
Traceback (most recent call last):
File "", line 1, in
File "/root/Environments/ansible2/lib/python2.6/site-packages/ansible/inventory/__init__.py", line 299, in list_groups
return sorted([ g.name for g in self.groups ], key=lambda x: x.name)
File "/root/Environments/ansible2/lib/python2.6/site-packages/ansible/inventory/__init__.py", line 299, in
return sorted([ g.name for g in self.groups ], key=lambda x: x.name)
AttributeError: 'str' object has no attribute 'name'
```

May be reported as a bug as well.