Browse Source

Bugfixes.

cmd_module
Slash 9 years ago
parent
commit
5a704fe5cb
4 changed files with 36 additions and 5 deletions
  1. +24
    -0
      make_get_request.py
  2. +3
    -1
      make_ssh_host_request.py
  3. +3
    -1
      make_ssh_user_request.py
  4. +6
    -3
      request_server.py

+ 24
- 0
make_get_request.py View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
import argparse
import json
def main(args):
result_dict = {}
result_dict['type'] = 'get_certificate'
result_dict['requestID'] = args.request_id
print(json.dumps(result_dict))
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument('request_id')
return parser
if __name__ == '__main__':
parser = get_parser()
main(parser.parse_args())

+ 3
- 1
make_ssh_host_request.py View File

@ -14,7 +14,9 @@ def main(args):
result_dict['keyData'] = key_data
print(json.dumps(result_dict))
request = { 'type': 'sign_request', 'request': result_dict }
print(json.dumps(request))
def get_parser():


+ 3
- 1
make_ssh_user_request.py View File

@ -15,7 +15,9 @@ def main(args):
result_dict['keyData'] = key_data
print(json.dumps(result_dict))
request = { 'type': 'sign_request', 'request': result_dict }
print(json.dumps(request))
def get_parser():


+ 6
- 3
request_server.py View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3
import json
import os.path
import sys
import time
@ -17,8 +18,10 @@ def exit_good(response):
def exit_bad(reason):
response['status'] = 'error'
response['reason'] = reason
response = {
'status': 'error',
'reason': reason
}
print(json.dumps(response))
sys.exit(0)
@ -55,7 +58,7 @@ def main():
with open(result_path, 'r') as stream:
result_data = stream.read()
exit_good({ 'requestID': request_id, 'requestData': request_data })
exit_good({ 'requestID': request_id, 'result': result_data })
else:
exit_bad('unknown_type')


Loading…
Cancel
Save