Browse Source

set log before exit call

readme
Edoardo Putti 8 years ago
parent
commit
3d96c909ec
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      request_server.py

+ 4
- 1
request_server.py View File

@ -55,6 +55,7 @@ def main():
assert 'type' in metarequest assert 'type' in metarequest
except: except:
logger.info('"Type" key not found in request') logger.info('"Type" key not found in request')
logger.info('Stopping shell')
exit_bad('bad_json') exit_bad('bad_json')
if metarequest['type'] == 'sign_request': if metarequest['type'] == 'sign_request':
@ -67,6 +68,7 @@ def main():
with open(os.path.join(REQUESTS_PATH, request_id), 'w') as stream: with open(os.path.join(REQUESTS_PATH, request_id), 'w') as stream:
stream.write(json.dumps(request)) stream.write(json.dumps(request))
logger.info('Stopping shell')
exit_good({ 'requestID': request_id }) exit_good({ 'requestID': request_id })
elif metarequest['type'] == 'get_certificate': elif metarequest['type'] == 'get_certificate':
@ -82,13 +84,14 @@ def main():
with open(result_path, 'r') as stream: with open(result_path, 'r') as stream:
result_data = stream.read() result_data = stream.read()
logger.info('Stopping shell')
exit_good({ 'requestID': request_id, 'result': result_data }) exit_good({ 'requestID': request_id, 'result': result_data })
else: else:
logger.info('Request type not supported: %s', metarequest['type']) logger.info('Request type not supported: %s', metarequest['type'])
logger.info('Stopping shell')
exit_bad('unknown_type') exit_bad('unknown_type')
logger.info('Stopping shell')
if __name__ == '__main__': if __name__ == '__main__':
main() main()

Loading…
Cancel
Save