From b63d75f2bb454410558bd0843e7e756143e93796 Mon Sep 17 00:00:00 2001 From: tkucherera Date: Fri, 29 Sep 2023 12:07:38 -0400 Subject: [PATCH] change to remove to many conditionals --- confluent_client/bin/nodersync | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/confluent_client/bin/nodersync b/confluent_client/bin/nodersync index b53b6f34..8d316bab 100755 --- a/confluent_client/bin/nodersync +++ b/confluent_client/bin/nodersync @@ -65,18 +65,20 @@ def run(): c = client.Command() cmdstr = ' '.join(args[:-1]) cmdstr = 'rsync -av --info=progress2 ' + cmdstr - if options.loginname and options.substitutename: - cmdstr += ' {}@'.format(options.loginname) + '{node}' + '{}:'.format(options.substitutename) + targpath - elif options.loginname and not options.substitutename: - cmdstr += ' {}@'.format(options.loginname) + '{node}:' + targpath - elif options.substitutename and not options.loginname: - subname = options.substitutename - if '{' not in subname: - cmdstr += ' {node}' + '{}:'.format(subname) + targpath - else: - cmdstr += ' {}:'.format(subname) + targpath + + targname = options.substitutename + if targname and '{' in targname: + targname = targname + ':' + elif targname: + targname = '{node}' + targname + ':' else: - cmdstr += ' {node}:' + targpath + targname = '{node}:' + + if options.loginname: + cmdstr += ' {}@'.format(options.loginname) + targname + targpath + else: + cmdstr += ' {}'.format(targname) + targpath + currprocs = 0 all = set([])