2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-12-25 12:41:39 +00:00

Provide more interesting response body to syncfileclient

This commit is contained in:
Jarrod Johnson 2024-04-09 14:27:00 -04:00
parent 02f301b5d0
commit 8ca9a44476
2 changed files with 6 additions and 6 deletions

View File

@ -517,8 +517,8 @@ def handle_request(env, start_response):
pals = get_extra_names(nodename, cfg, myip)
result = syncfiles.start_syncfiles(
nodename, cfg, json.loads(reqbody), pals)
start_response(result, ())
yield ''
start_response(result[0], ())
yield result[1]
return
if 'GET' == operation:
status, output = syncfiles.get_syncresult(nodename)

View File

@ -290,7 +290,7 @@ syncrunners = {}
def start_syncfiles(nodename, cfg, suffixes, principals=[]):
peerip = None
if nodename in syncrunners:
return '503 Synchronization already in progress '
return '503 Synchronization already in progress', 'Synchronization already in progress for {}'.format(nodename)
if 'myips' in suffixes:
targips = suffixes['myips']
del suffixes['myips']
@ -313,13 +313,13 @@ def start_syncfiles(nodename, cfg, suffixes, principals=[]):
raise Exception('Cannot perform syncfiles without profile assigned')
synclist = '/var/lib/confluent/public/os/{}/syncfiles'.format(profile)
if not os.path.exists(synclist):
return '200 OK' # not running
return '200 OK', 'No synclist' # not running
sl = SyncList(synclist, nodename, cfg)
if not (sl.appendmap or sl.mergemap or sl.replacemap or sl.appendoncemap):
return '200 OK' # the synclist has no actual entries
return '200 OK', 'Empty synclist' # the synclist has no actual entries
syncrunners[nodename] = eventlet.spawn(
sync_list_to_node, sl, nodename, suffixes, peerip)
return '202 Queued' # backgrounded
return '202 Queued', 'Background synchronization initiated' # backgrounded
def get_syncresult(nodename):
if nodename not in syncrunners: