move web config functions to yunohost_domain.py

This commit is contained in:
Kload 2013-02-27 22:29:31 +01:00
parent bf2bfe626e
commit edd6f7d42e
2 changed files with 14 additions and 2 deletions

View file

@ -67,7 +67,19 @@ def domain_add(domains, web=False):
domains = [ domains ]
for domain in domains:
yldap.validate_uniqueness({ 'virtualdomain' : domain })
try:
yldap.validate_uniqueness({ 'virtualdomain' : domain })
except YunoHostError:
if web:
_apache_config(domain)
_lemon_config(domain)
win_msg(_("Web config created"))
break
else:
raise YunoHostError(17, _("Domain already created"))
attr_dict['virtualdomain'] = domain
try:

View file

@ -109,7 +109,7 @@ def tools_maindomain(old_domain, new_domain):
for line in lines:
sources.write(re.sub(r''+ old_domain +'', new_domain, line))
domain_add([domain], web=True)
domain_add([new_domain], web=True)
lemon_tmp_conf = '/tmp/tmplemonconf'
if os.path.exists(lemon_tmp_conf): os.remove(lemon_tmp_conf)