From 74c3f122757b2ce246e15b9c661c847dd85fa45c Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 26 Jul 2018 14:37:10 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=B7=BB=E5=8A=A0=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E5=B0=86windows=E5=8D=8F=E8=AE=AE=E6=94=B9=E4=B8=BArd?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/models/domain.py | 2 +- utils/2018_07_15_set_win_protocol_to_ssh.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 utils/2018_07_15_set_win_protocol_to_ssh.sh diff --git a/apps/assets/models/domain.py b/apps/assets/models/domain.py index 6f29a0381..61c3bcc1f 100644 --- a/apps/assets/models/domain.py +++ b/apps/assets/models/domain.py @@ -43,7 +43,7 @@ class Gateway(AssetUser): ip = models.GenericIPAddressField(max_length=32, verbose_name=_('IP'), db_index=True) port = models.IntegerField(default=22, verbose_name=_('Port')) protocol = models.CharField(choices=PROTOCOL_CHOICES, max_length=16, default=SSH_PROTOCOL, verbose_name=_("Protocol")) - domain = models.ForeignKey(Domain, verbose_name=_("Domain")) + domain = models.ForeignKey(Domain, verbose_name=_("Domain"), on_delete=models.CASCADE) comment = models.CharField(max_length=128, blank=True, null=True, verbose_name=_("Comment")) is_active = models.BooleanField(default=True, verbose_name=_("Is active")) diff --git a/utils/2018_07_15_set_win_protocol_to_ssh.sh b/utils/2018_07_15_set_win_protocol_to_ssh.sh new file mode 100644 index 000000000..6d8596244 --- /dev/null +++ b/utils/2018_07_15_set_win_protocol_to_ssh.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# + +python ../apps/manage.py shell << EOF +from assets.models import Asset + +Asset.objects.filter(platform__startswith='Win').update(protocol='rdp') + +EOF