From ac875d39618f7b8217c0c05330fcae48d43b6662 Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 24 Dec 2014 22:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jump.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jump.py b/jump.py index 72e4c03a5..955943cb2 100755 --- a/jump.py +++ b/jump.py @@ -150,8 +150,8 @@ def posix_shell(chan, user, host): log.close() -def get_host_all(username): - host_all = {} +def get_user_host(username): + hosts = {} try: user = User.objects.get(username=username) except AttributeError: @@ -159,8 +159,8 @@ def get_host_all(username): else: perm_all = user.permission_set.all() for perm in perm_all: - host_all[perm.asset.ip] = perm.asset.comment - return host_all + hosts[perm.asset.ip] = perm.asset.comment + return hosts def print_prompt(): @@ -175,7 +175,7 @@ def print_prompt(): def print_user_host(username): - host_all = get_host_all(username) + host_all = get_user_host(username) for ip, comment in host_all.items(): print '%s -- %s' % (ip, comment) @@ -231,7 +231,7 @@ if __name__ == '__main__': except EOFError: continue if option in ['P', 'p']: - print_user_host() + print_user_host(username) continue elif option in ['E', 'e']: pass