From 958be7d00488667d2b37b81e435457f3f56c8b9f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 14 Jul 2016 09:15:49 -0400 Subject: [PATCH] Fix 'cd' to /noderange/nr in confetty The cd performance optimization caused a problem. This commit recognizes /noderange/ as special auto-vivifying directory that must be 'gotten'. --- confluent_client/bin/confetty | 40 ++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/confluent_client/bin/confetty b/confluent_client/bin/confetty index 4c471d2e..fe65742f 100755 --- a/confluent_client/bin/confetty +++ b/confluent_client/bin/confetty @@ -2,7 +2,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2014 IBM Corporation -# Copyright 2015 Lenovo +# Copyright 2015-2016 Lenovo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -316,21 +316,31 @@ def do_command(command, server): if parentpath: childname = '{0}/'.format(parentpath[parentpath.rindex('/') + 1:]) parentpath = parentpath[:parentpath.rindex('/') + 1] - foundchild = False - for res in session.read(parentpath, server): - try: - if res['item']['href'] == childname: - foundchild = True - except KeyError: - pass - if 'errorcode' in res: - exitcode = res['errorcode'] - if 'error' in res: - sys.stderr.write(target + ': ' + res['error'] + '\n') + if parentpath == '/noderange/': + for res in session.read(target, server): + if 'errorcode' in res: + exitcode = res['errorcode'] + target = otarget + if 'error' in res: + sys.stderr.write(target + ': ' + res['error'] + '\n') + target = otarget + else: + foundchild = False + for res in session.read(parentpath, server): + try: + if res['item']['href'] == childname: + foundchild = True + except KeyError: + pass + if 'errorcode' in res: + exitcode = res['errorcode'] + target = otarget + if 'error' in res: + sys.stderr.write(target + ': ' + res['error'] + '\n') + target = otarget + if not foundchild: + sys.stderr.write(target + ': Target not found - \n') target = otarget - if not foundchild: - sys.stderr.write(target + ': Target not found - \n') - target = otarget elif argv[0] in ('cat', 'show', 'ls', 'dir'): if len(argv) > 1: targpath = fullpath_target(argv[1])