add host fqdn to server reply
1 parent dfd98cf commit b1a5d2e84ac2a015a16cb6bf4aa8bb7e6bbde2f8
@tundra tundra authored on 10 Mar 2017
Showing 1 changed file
View
2
■■■
python/grpcdemo_server.py
class HostCommand(grpcdemo_pb2_grpc.HostCommandServicer):
 
def runcommand(self, request, context):
time.sleep(DELAY)
return grpcdemo_pb2.Results(cmd_results=subprocess.check_output(request.command.split()))
return grpcdemo_pb2.Results(cmd_results="%s: %s" % (socket.getfqdn(), subprocess.check_output(request.command.split())))
 
 
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))