ansible/ansible — pull request #3001 by SirScott (2013-05-23 19:51:11+00:00)
Title: Fixes #2924: User creation always reports 'changed'

The user_group_membership() method of the User base class is intended to return a list of all groups that the user belongs to. This is then used to compare against a list of groups requested. If there is a delta, the difference will be applied.

Unfortunately, there seems to be a typo in the comparison and it checks for not equal on the group id instead of equality. Hence the returned value was an empty list.

In addition to fixing the check, i changed to use attr access instead of indexing, as I feel it improves readability.