Commit aac5eed9 authored by ibuler's avatar ibuler

[Update] 去掉debug

parent a412864c
......@@ -32,7 +32,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='asset',
name='protocols',
field=CharField(blank=True, max_length=128, null=True, verbose_name='Protocols'),
field=CharField(blank=True, default='ssh/22', max_length=128, verbose_name='Protocols'),
),
migrations.RunPython(migrate_assets_protocol),
migrations.DeleteModel(name='Protocol'),
......
......@@ -116,7 +116,7 @@ class Asset(ProtocolsMixin, OrgModelMixin):
verbose_name=_('Protocol'))
port = models.IntegerField(default=22, verbose_name=_('Port'))
protocols = models.CharField(max_length=128, null=True, blank=True, verbose_name=_("Protocols"))
protocols = models.CharField(max_length=128, default='ssh/22', blank=True, verbose_name=_("Protocols"))
platform = models.CharField(max_length=128, choices=PLATFORM_CHOICES, default='Linux', verbose_name=_('Platform'))
domain = models.ForeignKey("assets.Domain", null=True, blank=True, related_name='assets', verbose_name=_("Domain"), on_delete=models.SET_NULL)
nodes = models.ManyToManyField('assets.Node', default=default_node, related_name='assets', verbose_name=_("Nodes"))
......
......@@ -492,21 +492,14 @@ class AssetPermissionUtil(AssetPermissionCacheMixin):
for node in nodes:
pattern.add(r'^{0}$|^{0}:'.format(node.key))
pattern = '|'.join(list(pattern))
print(self.object.username)
print(pattern)
print("Start get nodes assets")
clock1 = time.clock()
if pattern:
assets = Asset.objects.filter(nodes__key__regex=pattern) \
.prefetch_related('nodes')\
.only(*self.assets_only)\
.distinct()
# .prefetch_related('nodes')\
else:
assets = []
assets = list(assets)
print("get nodes assets using: {}".format(time.clock() - clock1))
print(len(assets))
return []
self.tree.add_assets_without_system_users(assets)
assets = self.tree.get_assets()
self._assets = assets
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment