From 6aaf6a315034354d1289b16763f80f40aea7fdc9 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Thu, 26 Jan 2017 15:19:27 -0500 Subject: [PATCH] allow can_add to be called for permission info * can_add() is called through our generic permission/access framework for api creation (POST). However, can_add() may also be called for purposes of determining if a user has perms to do something. Thus, the data field may not contain 'name' in this case. Allow for that. --- awx/main/access.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/main/access.py b/awx/main/access.py index 52794eee7a..fb51567735 100644 --- a/awx/main/access.py +++ b/awx/main/access.py @@ -614,7 +614,7 @@ class HostAccess(BaseAccess): return False # Check to see if we have enough licenses - self.check_license(add_host_name=data['name']) + self.check_license(add_host_name=data.get('name', None)) return True def can_change(self, obj, data):