[Kimchi-devel] [PATCH] list host user names as less a possible

Sheldon shaohef at linux.vnet.ibm.com
Mon Aug 11 16:06:35 UTC 2014


On 08/12/2014 12:04 AM, shaohef at linux.vnet.ibm.com wrote:
> From: Simon Jin <simonjin at linux.vnet.ibm.com>
>
> The backend should fitler the user name who can not login the shell.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> Signed-off-by: Simon Jin <simonjin at 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 at linux.vnet.ibm.com>
IBM Linux Technology Center

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140812/baa8c87c/attachment.html>


More information about the Kimchi-devel mailing list