From 6ac51b7b134e5093edd82bbfac9091689118d189 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Wed, 20 Feb 2019 13:15:51 -0500 Subject: [PATCH] Update the permission error to include max_hosts and the current host count --- awx/main/access.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/awx/main/access.py b/awx/main/access.py index 1c450f98f4..e895986906 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -345,12 +345,16 @@ class BaseAccess(object): active_count = Host.objects.org_active_count(org.id) if active_count > org.max_hosts: - raise PermissionDenied(_("The organization host limit has been exceeded.")) + raise PermissionDenied( + _("Organization host limit of %s has been exceeded, %s hosts active.") % + (org.max_hosts, active_count)) if add_host_name: host_exists = Host.objects.filter(inventory__organization=org.id, name=add_host_name).exists() if not host_exists and active_count == org.max_hosts: - raise PermissionDenied(_("The organization host limit has been exceeded.")) + raise PermissionDenied( + _("Organization host limit of %s has been exceeded, %s hosts active.") % + (org.max_hosts, active_count)) def get_user_capabilities(self, obj, method_list=[], parent_obj=None, capabilities_cache={}): if obj is None: