From 365b84ee69f2bcc4e8fe8cd36c6a1d98b11f17e4 Mon Sep 17 00:00:00 2001 From: Kload Date: Mon, 3 Mar 2014 13:18:46 +0100 Subject: [PATCH] Return main domain if no domain is provide (closes #91) --- yunohost_tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yunohost_tools.py b/yunohost_tools.py index aecd9ce9..065b1681 100644 --- a/yunohost_tools.py +++ b/yunohost_tools.py @@ -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 = [