This commit is contained in:
Kload 2013-10-17 09:45:02 +00:00
parent 654eb0d99a
commit e6c1af70ee
2 changed files with 3 additions and 11 deletions

View file

@ -31,8 +31,6 @@ import shutil
from urllib import urlopen from urllib import urlopen
from yunohost import YunoHostError, YunoHostLDAP, win_msg, colorize, validate, get_required_args from yunohost import YunoHostError, YunoHostLDAP, win_msg, colorize, validate, get_required_args
a2_template_path = '/etc/yunohost/apache/templates'
a2_app_conf_path = '/etc/yunohost/apache/domains'
def domain_list(filter=None, limit=None, offset=None): def domain_list(filter=None, limit=None, offset=None):
""" """
@ -66,13 +64,12 @@ def domain_list(filter=None, limit=None, offset=None):
return { 'Domains': result_list } return { 'Domains': result_list }
def domain_add(domains, raw=False, main=False): def domain_add(domains, main=False):
""" """
Create a custom domain Create a custom domain
Keyword argument: Keyword argument:
domains -- Domain name to add domains -- Domain name to add
raw -- Do not configure Apache and LemonLDAP for the domain
""" """
with YunoHostLDAP() as yldap: with YunoHostLDAP() as yldap:
@ -114,12 +111,7 @@ def domain_add(domains, raw=False, main=False):
try: try:
yldap.validate_uniqueness({ 'virtualdomain' : domain }) yldap.validate_uniqueness({ 'virtualdomain' : domain })
except YunoHostError: except YunoHostError:
if not raw: raise YunoHostError(17, _("Domain already created"))
win_msg(_("Web config created"))
result.append(domain)
break
else:
raise YunoHostError(17, _("Domain already created"))
attr_dict['virtualdomain'] = domain attr_dict['virtualdomain'] = domain

View file

@ -162,7 +162,7 @@ def tools_maindomain(old_domain, new_domain, dyndns=False):
for line in lines: for line in lines:
sources.write(re.sub(r''+ old_domain +'', new_domain, line)) sources.write(re.sub(r''+ old_domain +'', new_domain, line))
domain_add([new_domain], raw=False, main=True) domain_add([new_domain], main=True)
# TODO: Generate SSOwat conf # TODO: Generate SSOwat conf