mirror of
https://github.com/ansible/awx.git
synced 2026-01-18 05:01:19 -03:30
Update the permission error to include max_hosts and the current host count
This commit is contained in:
parent
97cc467ae1
commit
6ac51b7b13
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user