mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 11:25:08 -02:30
Only allow provision_instances without options to be used on k8s
This commit is contained in:
committed by
Shane McDonald
parent
fe5736dc7f
commit
28fa90e9e5
@@ -1,8 +1,9 @@
|
|||||||
# Copyright (c) 2015 Ansible, Inc.
|
# Copyright (c) 2015 Ansible, Inc.
|
||||||
# All Rights Reserved
|
# All Rights Reserved
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from awx.main.models import Instance
|
from awx.main.models import Instance
|
||||||
|
|
||||||
@@ -22,6 +23,8 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
def _register_hostname(self, hostname, node_type, uuid):
|
def _register_hostname(self, hostname, node_type, uuid):
|
||||||
if not hostname:
|
if not hostname:
|
||||||
|
if not settings.AWX_AUTO_DEPROVISION_INSTANCES:
|
||||||
|
raise CommandError('Registering with values from settings only intended for use in K8s installs')
|
||||||
(changed, instance) = Instance.objects.get_or_register()
|
(changed, instance) = Instance.objects.get_or_register()
|
||||||
else:
|
else:
|
||||||
(changed, instance) = Instance.objects.register(hostname=hostname, node_type=node_type, uuid=uuid)
|
(changed, instance) = Instance.objects.register(hostname=hostname, node_type=node_type, uuid=uuid)
|
||||||
|
|||||||
Reference in New Issue
Block a user