From 28fa90e9e5c0895164a20ab154824d5a3d03829c Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Tue, 29 Mar 2022 16:24:06 -0400 Subject: [PATCH] Only allow provision_instances without options to be used on k8s --- awx/main/management/commands/provision_instance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/main/management/commands/provision_instance.py b/awx/main/management/commands/provision_instance.py index b873cb2fd5..aeae496306 100644 --- a/awx/main/management/commands/provision_instance.py +++ b/awx/main/management/commands/provision_instance.py @@ -1,8 +1,9 @@ # Copyright (c) 2015 Ansible, Inc. # 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.conf import settings from awx.main.models import Instance @@ -22,6 +23,8 @@ class Command(BaseCommand): def _register_hostname(self, hostname, node_type, uuid): 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() else: (changed, instance) = Instance.objects.register(hostname=hostname, node_type=node_type, uuid=uuid)