Browse Source

permit passing key content as argument

cmd_module
Andrea Cimbalo 8 years ago
parent
commit
d45238ec1e
3 changed files with 18 additions and 9 deletions
  1. +6
    -3
      make_ssh_host_request.py
  2. +6
    -3
      make_ssh_user_request.py
  3. +6
    -3
      make_ssl_host_request.py

+ 6
- 3
make_ssh_host_request.py View File

@ -2,15 +2,18 @@
import argparse
import json
from os import path
def main(args):
result_dict = {}
result_dict['keyType'] = 'ssh_host'
result_dict['hostName'] = args.host_name
with open(args.pub_key_path, 'r') as stream:
key_data = stream.read().strip()
if path.exists(args.pub_key_path):
with open(args.pub_key_path, 'r') as stream:
key_data = stream.read().strip()
else:
key_data = args.pub_key_path
result_dict['keyData'] = key_data


+ 6
- 3
make_ssh_user_request.py View File

@ -2,7 +2,7 @@
import argparse
import json
from os import path
def main(args):
result_dict = {}
@ -10,8 +10,11 @@ def main(args):
result_dict['rootRequested'] = args.root_access
result_dict['userName'] = args.user_name
with open(args.pub_key_path, 'r') as stream:
key_data = stream.read().strip()
if path.exists(args.pub_key_path):
with open(args.pub_key_path, 'r') as stream:
key_data = stream.read().strip()
else:
key_data = args.pub_key_path
result_dict['keyData'] = key_data


+ 6
- 3
make_ssl_host_request.py View File

@ -2,15 +2,18 @@
import argparse
import json
from os import path
def main(args):
result_dict = {}
result_dict['keyType'] = 'ssl_host'
result_dict['hostName'] = args.host_name
with open(args.pub_key_path, 'r') as stream:
key_data = stream.read().strip()
if path.exists(args.pub_key_path):
with open(args.pub_key_path, 'r') as stream:
key_data = stream.read().strip()
else:
key_data = args.pub_key_path
result_dict['keyData'] = key_data


Loading…
Cancel
Save