From fdbf3ed27974d5e9089d54505d64c6c223ba1de4 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Wed, 26 Jan 2022 11:50:57 -0500 Subject: [PATCH] Only do a warning on 2-cycles for the register_peers command It has no way of knowing whether a later command will fix the situation, and this will come up in the installer. Let's just trust the pre-flight checks. --- awx/main/management/commands/register_peers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/awx/main/management/commands/register_peers.py b/awx/main/management/commands/register_peers.py index 7e5f0da309..6d26ebfbb2 100644 --- a/awx/main/management/commands/register_peers.py +++ b/awx/main/management/commands/register_peers.py @@ -1,3 +1,5 @@ +import warnings + from django.core.management.base import BaseCommand, CommandError from django.db import transaction @@ -45,7 +47,7 @@ class Command(BaseCommand): peers = set(options['peers'] or options['exact']) incoming = set(InstanceLink.objects.filter(target=nodes[options['source']]).values_list('source__hostname', flat=True)) if peers & incoming: - raise CommandError(f"Source node {options['source']} cannot link to nodes already peering to it: {peers & incoming}.") + warnings.warn(f"Source node {options['source']} should not link to nodes already peering to it: {peers & incoming}.") if options['peers']: missing_peers = set(options['peers']) - set(nodes)