mirror of
https://github.com/ansible/awx.git
synced 2026-02-17 11:10:03 -03:30
Add error messages to the new register_peers command
This commit is contained in:
@@ -16,10 +16,11 @@ class Command(BaseCommand):
|
|||||||
def handle(self, **options):
|
def handle(self, **options):
|
||||||
nodes = Instance.objects.in_bulk(field_name='hostname')
|
nodes = Instance.objects.in_bulk(field_name='hostname')
|
||||||
if options['source'] not in nodes:
|
if options['source'] not in nodes:
|
||||||
raise CommandError()
|
raise CommandError(f"Host {options['source']} is not a registered instance.")
|
||||||
missing_peers = set(options['peers']) - set(nodes)
|
missing_peers = set(options['peers']) - set(nodes)
|
||||||
if missing_peers:
|
if missing_peers:
|
||||||
raise CommandError()
|
missing = ' '.join(missing_peers)
|
||||||
|
raise CommandError(f"Peers not currently registered as instances: {missing}")
|
||||||
|
|
||||||
results = 0
|
results = 0
|
||||||
for target in options['peers']:
|
for target in options['peers']:
|
||||||
|
|||||||
Reference in New Issue
Block a user