[PATCH] list host user names as less a possible

From: Simon Jin <simonjin@linux.vnet.ibm.com> The backend should fitler the user name who can not login the shell. Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> Signed-off-by: Simon Jin <simonjin@linux.vnet.ibm.com> --- src/kimchi/model/host.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py index a1f8944..39f45d8 100644 --- a/src/kimchi/model/host.py +++ b/src/kimchi/model/host.py @@ -419,7 +419,8 @@ def __init__(self, **kargs): pass def get_list(self): - return [user.pw_name for user in pwd.getpwall()] + return [user.pw_name for user in pwd.getpwall() + if user.pw_shell.rsplit("/")[-1] not in ["nologin", "false"]] class GroupsModel(object): -- 1.9.3

On 08/12/2014 12:04 AM, shaohef@linux.vnet.ibm.com wrote:
From: Simon Jin <simonjin@linux.vnet.ibm.com>
The backend should fitler the user name who can not login the shell.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> Signed-off-by: Simon Jin <simonjin@linux.vnet.ibm.com> --- src/kimchi/model/host.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py index a1f8944..39f45d8 100644 --- a/src/kimchi/model/host.py +++ b/src/kimchi/model/host.py @@ -419,7 +419,8 @@ def __init__(self, **kargs): pass
def get_list(self): - return [user.pw_name for user in pwd.getpwall()] + return [user.pw_name for user in pwd.getpwall() + if user.pw_shell.rsplit("/")[-1] not in ["nologin", "false"]] need to check the group filter. can [g.gr_name for g in grp.getgrall() if len(g.gr_mem) > 0] work well.
class GroupsModel(object):
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center

Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 08/11/2014 01:04 PM, shaohef@linux.vnet.ibm.com wrote:
From: Simon Jin <simonjin@linux.vnet.ibm.com>
The backend should fitler the user name who can not login the shell.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> Signed-off-by: Simon Jin <simonjin@linux.vnet.ibm.com> --- src/kimchi/model/host.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py index a1f8944..39f45d8 100644 --- a/src/kimchi/model/host.py +++ b/src/kimchi/model/host.py @@ -419,7 +419,8 @@ def __init__(self, **kargs): pass
def get_list(self): - return [user.pw_name for user in pwd.getpwall()] + return [user.pw_name for user in pwd.getpwall() + if user.pw_shell.rsplit("/")[-1] not in ["nologin", "false"]]
class GroupsModel(object):
participants (3)
-
Aline Manera
-
shaohef@linux.vnet.ibm.com
-
Sheldon