mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Add error messages to the new register_peers command
This commit is contained in:
parent
ce5aefd3d8
commit
fc2a5224ef
@ -16,10 +16,11 @@ class Command(BaseCommand):
|
||||
def handle(self, **options):
|
||||
nodes = Instance.objects.in_bulk(field_name='hostname')
|
||||
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)
|
||||
if missing_peers:
|
||||
raise CommandError()
|
||||
missing = ' '.join(missing_peers)
|
||||
raise CommandError(f"Peers not currently registered as instances: {missing}")
|
||||
|
||||
results = 0
|
||||
for target in options['peers']:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user