Return main domain if no domain is provide (closes #91)

This commit is contained in:
Kload 2014-03-03 13:18:46 +01:00
parent 3cafe1dda0
commit 365b84ee69

View file

@ -99,7 +99,7 @@ def tools_adminpw(old_password, new_password):
raise YunoHostError(22, _("Invalid password"))
def tools_maindomain(old_domain, new_domain, dyndns=False):
def tools_maindomain(old_domain=None, new_domain=None, dyndns=False):
"""
Main domain change tool
@ -113,6 +113,9 @@ def tools_maindomain(old_domain, new_domain, dyndns=False):
with open('/etc/yunohost/current_host', 'r') as f:
old_domain = f.readline().rstrip()
if not new_domain:
return { 'Current main domain': old_domain }
validate(r'^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$', old_domain)
config_files = [