#NEWLINE# @ wsgi . response ( 200 ) #NEWLINE# def update_proxy( self , req , body , gid ) : #NEWLINE# #INDENT# def _validate( context , body , gid ) : #NEWLINE# #INDENT# self . _uuid_check ( gid ) #NEWLINE# process = db . process_get_all ( context , gid , filters = { #NEWLINE# #INDENT# 'is_proxy' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( not process ) : #NEWLINE# #INDENT# msg = _ ( ( 'Proxy process does not exist in the group %s' % gid ) ) #NEWLINE# raise exception . InvalidInput ( reason = msg ) #NEWLINE# #UNINDENT# if ( not self . is_valid_body ( body , 'proxy' ) ) : #NEWLINE# #INDENT# msg = _ ( 'Invalid request body' ) #NEWLINE# raise exception . InvalidInput ( reason = msg ) #NEWLINE# #UNINDENT# values = body [ 'proxy' ] #NEWLINE# app_status = values . get ( 'app_status' ) #NEWLINE# ipc_endpoint = values . get ( 'ipc_endpoint' ) #NEWLINE# shm_endpoint = values . get ( 'shm_endpoint' ) #NEWLINE# fs_endpoint = values . get ( 'fs_endpoint' ) #NEWLINE# valid_values = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if app_status : #NEWLINE# #INDENT# utils . check_string_length ( app_status , 'app_status' , min_length = 1 , max_length = 255 ) #NEWLINE# valid_values [ 'app_status' ] = app_status #NEWLINE# #UNINDENT# if ipc_endpoint : #NEWLINE# #INDENT# utils . check_string_length ( ipc_endpoint , 'ipc_endpoint' , min_length = 1 , max_length = 255 ) #NEWLINE# valid_values [ 'ipc_endpoint' ] = ipc_endpoint #NEWLINE# #UNINDENT# if shm_endpoint : #NEWLINE# #INDENT# utils . check_string_length ( shm_endpoint , 'shm_endpoint' , min_length = 1 , max_length = 255 ) #NEWLINE# valid_values [ 'shm_endpoint' ] = shm_endpoint #NEWLINE# #UNINDENT# if fs_endpoint : #NEWLINE# #INDENT# utils . check_string_length ( fs_endpoint , 'fs_endpoint' , min_length = 1 , max_length = 255 ) #NEWLINE# valid_values [ 'fs_endpoint' ] = fs_endpoint #NEWLINE# #UNINDENT# if ( not valid_values ) : #NEWLINE# #INDENT# msg = _ ( 'No keyword is provided.' ) #NEWLINE# raise exception . InvalidInput ( reason = msg ) #NEWLINE# #UNINDENT# return ( process [ 0 ] [ 'pid' ] , valid_values ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# context = req . environ [ 'rack.context' ] #NEWLINE# ( pid , values ) = _validate ( context , body , gid ) #NEWLINE# process = db . process_update ( context , gid , pid , values ) #NEWLINE# #UNINDENT# except exception . InvalidInput as e : #NEWLINE# #INDENT# raise webob . exc . HTTPBadRequest ( explanation = e . format_message ( ) ) #NEWLINE# #UNINDENT# except exception . ProcessNotFound as e : #NEWLINE# #INDENT# raise webob . exc . HTTPNotFound ( explanation = e . format_message ( ) ) #NEWLINE# #UNINDENT# return self . _view_builder . update ( process )