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.
This commit is contained in:
Toshio Kuratomi 2017-04-19 09:49:44 -07:00
parent d0e3d75381
commit a31e9bd9ea

View file

@ -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]: