From eee8bbb498dad16058d3ceeaba54e19beba16fe6 Mon Sep 17 00:00:00 2001 From: tkucherera Date: Wed, 27 Sep 2023 17:52:15 -0400 Subject: [PATCH 1/3] node rsync -s switch --- confluent_client/bin/nodersync | 12 ++++++++++-- confluent_client/doc/man/nodersync.ronn | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/confluent_client/bin/nodersync b/confluent_client/bin/nodersync index ba95662c..8e125ee8 100755 --- a/confluent_client/bin/nodersync +++ b/confluent_client/bin/nodersync @@ -48,6 +48,8 @@ def run(): 'prompting if over the threshold') argparser.add_option('-l', '--loginname', type='str', help='Username to use when connecting, defaults to current user.') + argparser.add_option('-s', '--substitutename', + help='Use a different name other than the nodename for rsync') argparser.add_option('-f', '-c', '--count', type='int', default=168, help='Number of nodes to concurrently rsync') # among other things, FD_SETSIZE limits. Besides, spawning too many @@ -63,8 +65,14 @@ def run(): c = client.Command() cmdstr = ' '.join(args[:-1]) cmdstr = 'rsync -av --info=progress2 ' + cmdstr - if options.loginname: - cmdstr += ' {}@'.format(options.loginname) + '{node}:' + targpath + 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(options.substitutename) + targpath else: cmdstr += ' {node}:' + targpath diff --git a/confluent_client/doc/man/nodersync.ronn b/confluent_client/doc/man/nodersync.ronn index 582f79d9..c187215e 100644 --- a/confluent_client/doc/man/nodersync.ronn +++ b/confluent_client/doc/man/nodersync.ronn @@ -16,6 +16,9 @@ noderange. This will present progress as percentage for all nodes. Specify how many rsync executions to do concurrently. If noderange exceeds the count, then excess nodes will wait until one of the active count completes. + +* `-s`, `--substitutename`: + 'Use a different name other than the nodename for rsync' * `-m MAXNODES`, `--maxnodes=MAXNODES`: Specify a maximum number of nodes to run rsync to, prompting if over the From 378929579f2fb36a738e12e5c232d998fbdaca34 Mon Sep 17 00:00:00 2001 From: tkucherera Date: Thu, 28 Sep 2023 08:56:52 -0400 Subject: [PATCH 2/3] Allow to be able to specify prefix as well --- confluent_client/bin/nodersync | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/confluent_client/bin/nodersync b/confluent_client/bin/nodersync index 8e125ee8..b53b6f34 100755 --- a/confluent_client/bin/nodersync +++ b/confluent_client/bin/nodersync @@ -72,7 +72,9 @@ def run(): elif options.substitutename and not options.loginname: subname = options.substitutename if '{' not in subname: - cmdstr += ' {node}' + '{}:'.format(options.substitutename) + targpath + cmdstr += ' {node}' + '{}:'.format(subname) + targpath + else: + cmdstr += ' {}:'.format(subname) + targpath else: cmdstr += ' {node}:' + targpath From b63d75f2bb454410558bd0843e7e756143e93796 Mon Sep 17 00:00:00 2001 From: tkucherera Date: Fri, 29 Sep 2023 12:07:38 -0400 Subject: [PATCH 3/3] 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([])