1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2025-10-31 03:29:03 +01:00

Changes to slim for LodelContext - some corrections

This commit is contained in:
prieto 2016-11-03 15:53:18 +01:00
commit 2daf715b61
2 changed files with 25 additions and 11 deletions

View file

@ -27,6 +27,11 @@ instdir="$2"
libdir="$5"
libdir=${libdir:=[@]PKGPYTHONDIR[@]}
install_tpl="$3"
if [ $name == "monosite" ];then
name=""
fi
if [ -z "$install_tpl" ]
then
echo -e "Install template $install_tpl not found.\n" >&2

View file

@ -166,22 +166,31 @@ lower&upper alphanum and '_'. Name '%s' is invalid" % name)
##@brief Create a new instance
#@param name str : the instance name
def new_instance(name):
name_is_valid(name)
store_datas = get_store_datas()
if name in store_datas:
logging.error("A site named '%s' already exists" % name)
exit(1)
if LodelContext._type == LodelContext.MONOSITE and len(store_datas) > 0:
logging.error("We are in monosite mode and a site already exists")
exit(1)
if LodelContext._type == LodelContext.MONOSITE:
store_datas = get_store_datas()
if len(store_datas) > 0:
logging.error("We are in monosite mode and a site already exists")
exit(1)
if name is not None:
logging.error("We are in monosite mode, we can't have a site name")
exit(1)
instance_path = INSTANCES_ABSPATH
else:
name_is_valid(name)
store_datas = get_store_datas()
if name in store_datas:
logging.error("A site named '%s' already exists" % name)
exit(1)
instance_path = os.path.join(INSTANCES_ABSPATH, name)
if not os.path.isdir(INSTANCES_ABSPATH):
logging.info("Sites directory '%s' doesn't exist, creating it" % INSTANCES_ABSPATH)
os.mkdir(INSTANCES_ABSPATH)
instance_path = os.path.join(INSTANCES_ABSPATH, name)
sitename = name if name is not None else 'monosite'
creation_cmd = '{script} "{name}" "{path}" "{install_tpl}" \
"{emfile}"'.format(
"{emfile}"'.format(
script = CREATION_SCRIPT,
name = name,
name = sitename,
path = instance_path,
install_tpl = INSTALL_TPL,
emfile = EMFILE)