From 3a3b06166a58a2a9524c4c34b06d82cb8974242c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 14 Mar 2014 11:11:58 -0600 Subject: [PATCH] Lint fixes for getgroupall code --- salt/modules/cmdmod.py | 2 +- salt/modules/mac_user.py | 1 - salt/modules/pw_user.py | 1 - salt/modules/solaris_user.py | 1 - salt/modules/useradd.py | 1 - salt/states/user.py | 1 - salt/utils/__init__.py | 5 +++-- 7 files changed, 4 insertions(+), 8 deletions(-) diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py index ab6a15caca76..954c4d17c603 100644 --- a/salt/modules/cmdmod.py +++ b/salt/modules/cmdmod.py @@ -74,7 +74,7 @@ def _chugid(runas): gid = __salt__['group.info'](group_name)['gid'] if (gid not in supgroups_seen and not supgroups_seen.add(gid)): - supgroups.append(gid) + supgroups.append(gid) # No logging can happen on this function # diff --git a/salt/modules/mac_user.py b/salt/modules/mac_user.py index e2e13952f48f..ee64b66a6461 100644 --- a/salt/modules/mac_user.py +++ b/salt/modules/mac_user.py @@ -5,7 +5,6 @@ # Import python libs try: - import grp import pwd except ImportError: pass diff --git a/salt/modules/pw_user.py b/salt/modules/pw_user.py index 669c2087cdbb..de948a349b1b 100644 --- a/salt/modules/pw_user.py +++ b/salt/modules/pw_user.py @@ -5,7 +5,6 @@ # Import python libs try: - import grp import pwd except ImportError: pass diff --git a/salt/modules/solaris_user.py b/salt/modules/solaris_user.py index 70cee5329c8f..2fcc51fe8472 100644 --- a/salt/modules/solaris_user.py +++ b/salt/modules/solaris_user.py @@ -5,7 +5,6 @@ # Import python libs try: - import grp import pwd except ImportError: pass diff --git a/salt/modules/useradd.py b/salt/modules/useradd.py index 93b6c883a74d..7b6bbd2f9e13 100644 --- a/salt/modules/useradd.py +++ b/salt/modules/useradd.py @@ -7,7 +7,6 @@ import re try: - import grp import pwd except ImportError: pass diff --git a/salt/states/user.py b/salt/states/user.py index a00c307b92ff..c8e69a6cc0e9 100644 --- a/salt/states/user.py +++ b/salt/states/user.py @@ -26,7 +26,6 @@ # Import python libs import logging -import sys # Import salt libs import salt.utils diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py index 77ec79297052..0cc852a50512 100644 --- a/salt/utils/__init__.py +++ b/salt/utils/__init__.py @@ -2097,6 +2097,7 @@ def repack_dictlist(data): ret.update(element) return ret + def get_group_list(user=None, include_default=True): ''' Returns a list of all of the system group names of which the user @@ -2111,7 +2112,7 @@ def get_group_list(user=None, include_default=True): try: group_names = list(os.getgrouplist(user, pwd.getpwnam(user).pw_gid)) log.trace('os.getgrouplist for user {0!r}: {1!r}'.format(user, group_names)) - except: + except Exception: pass else: # Try pysss.getgrouplist @@ -2120,7 +2121,7 @@ def get_group_list(user=None, include_default=True): import pysss group_names = list(pysss.getgrouplist(user)) log.trace('pysss.getgrouplist for user {0!r}: {1!r}'.format(user, group_names)) - except: + except Exception: pass if group_names is None: # Fall back to generic code