mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 22:46:01 -03:30
Trigger rabbitmq cluster node removal from deprovisioning
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# Copyright (c) 2016 Ansible, Inc.
|
# Copyright (c) 2016 Ansible, Inc.
|
||||||
# All Rights Reserved
|
# All Rights Reserved
|
||||||
|
|
||||||
|
import subprocess
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
from awx.main.models import Instance
|
from awx.main.models import Instance
|
||||||
@@ -22,7 +23,11 @@ class Command(BaseCommand):
|
|||||||
instance = Instance.objects.filter(hostname=options.get('name'))
|
instance = Instance.objects.filter(hostname=options.get('name'))
|
||||||
if instance.exists():
|
if instance.exists():
|
||||||
instance.delete()
|
instance.delete()
|
||||||
print('Successfully removed')
|
result = subprocess.Popen("rabbitmqctl forget_cluster_node rabbitmq@{}".format(options.get('name')), shell=True).wait()
|
||||||
|
if result != 0:
|
||||||
|
print("Node deprovisioning may have failed when attempting to remove the RabbitMQ instance from the cluster")
|
||||||
|
else:
|
||||||
|
print('Successfully deprovisioned {}'.format(options.get('name')))
|
||||||
else:
|
else:
|
||||||
print('No instance found matching name {}'.format(options.get('name')))
|
print('No instance found matching name {}'.format(options.get('name')))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user