From ff0955d6bee0cc1ead1781850852cc3c415e9844 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 25 Aug 2020 14:27:46 -0400 Subject: [PATCH] Final fix for nodedeploy without profile --- confluent_client/bin/nodedeploy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/confluent_client/bin/nodedeploy b/confluent_client/bin/nodedeploy index 4a675793..26441832 100755 --- a/confluent_client/bin/nodedeploy +++ b/confluent_client/bin/nodedeploy @@ -57,7 +57,7 @@ def setpending(nr, profile, cli): pass -def clearpending(nr, profile, cli): +def clearpending(nr, cli): for rsp in cli.update('/noderange/{0}/attributes/current'.format(nr), {'deployment.pendingprofile': ''}): pass @@ -70,12 +70,17 @@ def main(args): ap.add_argument('-m', '--maxnodes', help='Specifiy a maximum nodes to be deployed') ap.add_argument('noderange', help='Set of nodes to deploy') ap.add_argument('profile', nargs='?', help='Profile name to deploy') - args = ap.parse_args(args) + args, extra = ap.parse_args(args) if not args.network and not args.prepare and not args.clear: sys.stderr.write('-n or -p is a required argument currently\n') return 1 + if args.profile is None and len(extra) == 1: + args.profile = extra[0] + extra = extra[1:] + if extra: + sys.stderr.write('Unrecognized arguments: ' + repr(extra) + '\n') if not args.clear and args.profile is None: - sys.stderr.write(' is a required argument') + sys.stderr.write(' is a required argument\n') return 1 c = client.Command() c.stop_if_noderange_over(args.noderange, args.maxnodes)