Merge pull request #11546 from jbradberry/remove-instance-activecount

Remove the Instance.objects.active_count() method
This commit is contained in:
Jeff Bradberry
2022-01-14 16:46:01 -05:00
committed by GitHub
2 changed files with 1 additions and 5 deletions

View File

@@ -186,10 +186,6 @@ class InstanceManager(models.Manager):
else: else:
return (False, self.me()) return (False, self.me())
def active_count(self):
"""Return count of active Tower nodes for licensing."""
return self.exclude(node_type='hop').count()
class InstanceGroupManager(models.Manager): class InstanceGroupManager(models.Manager):
"""A custom manager class for the Instance model. """A custom manager class for the Instance model.

View File

@@ -77,7 +77,7 @@ def test_instance_dup(org_admin, organization, project, instance_factory, instan
ig_all = instance_group_factory("all", instances=[i1, i2, i3]) ig_all = instance_group_factory("all", instances=[i1, i2, i3])
ig_dup = instance_group_factory("duplicates", instances=[i1]) ig_dup = instance_group_factory("duplicates", instances=[i1])
project.organization.instance_groups.add(ig_all, ig_dup) project.organization.instance_groups.add(ig_all, ig_dup)
actual_num_instances = Instance.objects.active_count() actual_num_instances = Instance.objects.count()
list_response = get(reverse('api:instance_list'), user=system_auditor) list_response = get(reverse('api:instance_list'), user=system_auditor)
api_num_instances_auditor = list(list_response.data.items())[0][1] api_num_instances_auditor = list(list_response.data.items())[0][1]