mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 20:50:06 -03:30
License differentiation for HA.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
from django.core.management.base import CommandError
|
from django.core.management.base import CommandError
|
||||||
|
|
||||||
|
from awx.api.license import feature_enabled
|
||||||
from awx.main.management.commands._base_instance import BaseCommandInstance
|
from awx.main.management.commands._base_instance import BaseCommandInstance
|
||||||
from awx.main.models import Instance
|
from awx.main.models import Instance
|
||||||
|
|
||||||
@@ -32,6 +33,13 @@ class Command(BaseCommandInstance):
|
|||||||
|
|
||||||
uuid = self.get_UUID()
|
uuid = self.get_UUID()
|
||||||
|
|
||||||
|
# Are we attempting to register a secondary instance?
|
||||||
|
# If so, we are only willing to do that if the Tower license allows
|
||||||
|
# it.
|
||||||
|
if self.is_option_secondary() and not feature_enabled('ha'):
|
||||||
|
raise CommandError('Your Tower license does not permit creation '
|
||||||
|
'of secondary instances.')
|
||||||
|
|
||||||
# Is there an existing record for this machine? If so, retrieve that record and look for issues.
|
# Is there an existing record for this machine? If so, retrieve that record and look for issues.
|
||||||
try:
|
try:
|
||||||
instance = Instance.objects.get(uuid=uuid)
|
instance = Instance.objects.get(uuid=uuid)
|
||||||
@@ -58,6 +66,6 @@ class Command(BaseCommandInstance):
|
|||||||
# If this is a primary instance, update projects.
|
# If this is a primary instance, update projects.
|
||||||
if instance.primary:
|
if instance.primary:
|
||||||
self.update_projects(instance)
|
self.update_projects(instance)
|
||||||
|
|
||||||
# Done!
|
# Done!
|
||||||
print('Successfully registered instance %s.' % instance_str(instance))
|
print('Successfully registered instance %s.' % instance_str(instance))
|
||||||
|
|||||||
Reference in New Issue
Block a user