From 82856100976d0e7d584bbf17ce4a7bde4c815ee5 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 29 Jan 2019 14:07:46 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E5=88=9B=E5=BB=BAHost=20Key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/signals_handler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/common/signals_handler.py b/apps/common/signals_handler.py index 65721e155..b44dca787 100644 --- a/apps/common/signals_handler.py +++ b/apps/common/signals_handler.py @@ -71,11 +71,11 @@ def auto_generate_terminal_host_key(sender, **kwargs): try: if Setting.objects.filter(name='TERMINAL_HOST_KEY').exists(): return + private_key, public_key = ssh_key_gen() + value = json.dumps(private_key) + Setting.objects.create(name='TERMINAL_HOST_KEY', value=value) except: - return - private_key, public_key = ssh_key_gen() - value = json.dumps(private_key) - Setting.objects.create(name='TERMINAL_HOST_KEY', value=value) + pass @receiver(pre_save, dispatch_uid="my_unique_identifier")