Merge pull request #236 from zhongyehong/master
fix a bug of user directory not exists
This commit is contained in:
commit
04f6c9c923
|
@ -43,8 +43,9 @@ class Container(object):
|
|||
rootfs = "/var/lib/lxc/%s/rootfs" % lxc_name
|
||||
|
||||
if not os.path.isdir("%s/global/users/%s" % (self.fspath,username)):
|
||||
logger.error("user %s directory not found" % username)
|
||||
return [False, "user directory not found"]
|
||||
path = env.getenv('DOCKLET_LIB')
|
||||
subprocess.call([path+"/userinit.sh", username])
|
||||
logger.info("user %s directory not found, create it" % username)
|
||||
sys_run("mkdir -p /var/lib/lxc/%s" % lxc_name)
|
||||
logger.info("generate config file for %s" % lxc_name)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ USERNAME=$1
|
|||
echo "[Info] [userinit.sh] initialize for user $USERNAME"
|
||||
|
||||
USER_DIR=$FS_PREFIX/global/users/$USERNAME
|
||||
[ -d $USER_DIR ] && echo "[userinit.sh] user directory already exists, delete it" && rm -r $USER_DIR
|
||||
[ -d $USER_DIR ] && echo "[userinit.sh] user directory already exists" && exit 0
|
||||
|
||||
mkdir -p $USER_DIR/{clusters,hosts,data,ssh}
|
||||
|
||||
|
|
Loading…
Reference in New Issue