解决jperm key dir 和 ansible api问题

This commit is contained in:
ibuler
2015-11-17 23:32:24 +08:00
parent 375a243131
commit 8017b1b479
5 changed files with 7 additions and 14 deletions

View File

@@ -4,7 +4,7 @@ import random
import os.path
from paramiko.rsakey import RSAKey
from os import chmod, mkdir
from os import chmod, makedirs
from uuid import uuid4
from jumpserver.settings import KEY_DIR
@@ -45,8 +45,8 @@ def gen_keys():
:return: 返回目录名(uuid)
"""
key_basename = "key-" + uuid4().hex
key_path_dir = os.path.join(KEY_DIR, key_basename)
mkdir(key_path_dir, 0700)
key_path_dir = os.path.join(KEY_DIR, 'role_key', key_basename)
makedirs(key_path_dir, 0775)
key = RSAKey.generate(2048)
private_key = os.path.join(key_path_dir, 'id_rsa')
@@ -62,8 +62,6 @@ def gen_keys():
return key_path_dir
if __name__ == "__main__":
print gen_keys()