From 3805f031f58522ca14e5862fd625cc0f755f5955 Mon Sep 17 00:00:00 2001 From: Kload Date: Mon, 10 Jun 2013 13:05:31 +0200 Subject: [PATCH] add extra DNS entries for main domain --- yunohost_domain.py | 9 ++++++++- yunohost_tools.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/yunohost_domain.py b/yunohost_domain.py index 74e2f41e..8e34e0ae 100644 --- a/yunohost_domain.py +++ b/yunohost_domain.py @@ -46,13 +46,14 @@ def domain_list(filter=None, limit=None, offset=None): return { 'Domains': result_list } -def domain_add(domains, web=False): +def domain_add(domains, web=False, main=False): """ Add one or more domains Keyword argument: domains -- List of domains to add web -- Configure Apache and LemonLDAP for the domain too + main -- Is the main domain Returns: Dict @@ -136,6 +137,12 @@ def domain_add(domains, web=False): '_xmpp-server._tcp.'+ domain +'. IN SRV 0 5 5269 '+ domain +'.', '_jabber._tcp.'+ domain +'. IN SRV 0 5 5269 '+ domain +'.', ] + if main: + zone_lines.extend([ + 'pubsub.'+ domain +'. IN A '+ ip, + 'muc.'+ domain +'. IN A '+ ip, + 'vjud.'+ domain +'. IN A '+ ip + ]) with open('/var/lib/bind/' + domain + '.zone', 'w') as zone: for line in zone_lines: zone.write(line + '\n') diff --git a/yunohost_tools.py b/yunohost_tools.py index 35cefe05..13476099 100644 --- a/yunohost_tools.py +++ b/yunohost_tools.py @@ -108,7 +108,7 @@ def tools_maindomain(old_domain, new_domain): for line in lines: sources.write(re.sub(r''+ old_domain +'', new_domain, line)) - domain_add([new_domain], web=True) + domain_add([new_domain], web=True, main=True) lemon_conf_lines = [ "$tmp->{'domain'} = '"+ new_domain +"';", # Replace Lemon domain