Fix AC-758 where we weren't considering whether the license was expired when deciding to allow creating more hosts

This commit is contained in:
Matthew Jones 2014-01-05 16:56:41 -05:00
parent 36f094a8f8
commit a098ef4381

View File

@ -354,11 +354,14 @@ class HostAccess(BaseAccess):
# but still go down *most* of the license code path.
validation_info['free_instances'] = 99999999
if not validation_info.get('demo') and validation_info.get('time_remaining') < 0:
raise PermissionDenied("license has expired")
if validation_info.get('free_instances', 0) > 0:
# BOOKMARK
return True
instances = validation_info.get('available_instances', 0)
raise PermissionDenied("license range of %s instances has been exceed" % instances)
raise PermissionDenied("license range of %s instances has been exceeded" % instances)
def can_change(self, obj, data):
# Prevent moving a host to a different inventory.