mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 23:46:05 -03:30
Merge pull request #2450 from ryanpetrello/iso-deprovision-fix
don't call rabbitmqctl forget_cluster_node for isolated instances Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -41,14 +41,18 @@ class Command(BaseCommand):
|
|||||||
with advisory_lock('instance_registration_%s' % hostname):
|
with advisory_lock('instance_registration_%s' % hostname):
|
||||||
instance = Instance.objects.filter(hostname=hostname)
|
instance = Instance.objects.filter(hostname=hostname)
|
||||||
if instance.exists():
|
if instance.exists():
|
||||||
|
isolated = instance.first().is_isolated()
|
||||||
instance.delete()
|
instance.delete()
|
||||||
print("Instance Removed")
|
print("Instance Removed")
|
||||||
result = subprocess.Popen("rabbitmqctl forget_cluster_node rabbitmq@{}".format(hostname), shell=True).wait()
|
if isolated:
|
||||||
if result != 0:
|
|
||||||
print("Node deprovisioning may have failed when attempting to "
|
|
||||||
"remove the RabbitMQ instance {} from the cluster".format(hostname))
|
|
||||||
else:
|
|
||||||
print('Successfully deprovisioned {}'.format(hostname))
|
print('Successfully deprovisioned {}'.format(hostname))
|
||||||
|
else:
|
||||||
|
result = subprocess.Popen("rabbitmqctl forget_cluster_node rabbitmq@{}".format(hostname), shell=True).wait()
|
||||||
|
if result != 0:
|
||||||
|
print("Node deprovisioning may have failed when attempting to "
|
||||||
|
"remove the RabbitMQ instance {} from the cluster".format(hostname))
|
||||||
|
else:
|
||||||
|
print('Successfully deprovisioned {}'.format(hostname))
|
||||||
print('(changed: True)')
|
print('(changed: True)')
|
||||||
else:
|
else:
|
||||||
print('No instance found matching name {}'.format(hostname))
|
print('No instance found matching name {}'.format(hostname))
|
||||||
|
|||||||
Reference in New Issue
Block a user