From 18e159350b1309f1a53de7efe4d50aba2ceca387 Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 11 May 2016 11:10:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(api)=20=E4=BF=AE=E6=94=B9=E5=BB=BA=E7=AB=8B?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用bash代替python完成建立777目录的功能 --- jumpserver/api.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jumpserver/api.py b/jumpserver/api.py index a4840f206..b9732f49c 100644 --- a/jumpserver/api.py +++ b/jumpserver/api.py @@ -463,9 +463,8 @@ def mkdir(dir_name, username='', mode=0755): insure the dir exist and mode ok 目录存在,如果不存在就建立,并且权限正确 """ - if not os.path.isdir(dir_name): - os.makedirs(dir_name) - os.chmod(dir_name, mode) + cmd = 'mkdir -p %s && chmod %s %s' % (dir_name, mode, dir_name) + bash(cmd) if username: chown(dir_name, username)