From 2dcd0f769a176443a64814e0193d453ba07049ea Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 13 Sep 2021 13:48:56 -0400 Subject: [PATCH] Support defining multiple groups in one go --- confluent_client/bin/nodegroupdefine | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/confluent_client/bin/nodegroupdefine b/confluent_client/bin/nodegroupdefine index 6fd1f8a5..e226496d 100755 --- a/confluent_client/bin/nodegroupdefine +++ b/confluent_client/bin/nodegroupdefine @@ -45,14 +45,15 @@ except IndexError: client.check_globbing(noderange) session = client.Command() exitcode = 0 -attribs = {'name': noderange} -for arg in args[1:]: - key, val = arg.split('=', 1) - attribs[key] = val -for r in session.create('/nodegroups/', attribs): - if 'error' in r: - sys.stderr.write(r['error'] + '\n') - exitcode |= 1 - if 'created' in r: - print('{0}: created'.format(r['created'])) +for group in noderange.split(','): + attribs = {'name': group} + for arg in args[1:]: + key, val = arg.split('=', 1) + attribs[key] = val + for r in session.create('/nodegroups/', attribs): + if 'error' in r: + sys.stderr.write(r['error'] + '\n') + exitcode |= 1 + if 'created' in r: + print('{0}: created'.format(r['created'])) sys.exit(exitcode)