Really minor optimization and style change for d0e3d75381

* Use a generator expression instead of a list comprehension
* Use copy() to create a new set instead of the constructor.
pull/23739/merge
Toshio Kuratomi 8 years ago
parent d0e3d75381
commit a31e9bd9ea

@ -552,8 +552,8 @@ class User(object):
if self.groups is None:
return None
info = self.user_info()
groups = set([x.strip() for x in self.groups.split(',') if x])
for g in set(groups):
groups = set(x.strip() for x in self.groups.split(',') if x)
for g in groups.copy():
if not self.group_exists(g):
self.module.fail_json(msg="Group %s does not exist" % (g))
if info and remove_existing and self.group_info(g)[2] == info[3]:

Loading…
Cancel
Save