This commit is contained in:
Kload 2013-06-10 20:06:23 +00:00
commit 9c0de2cd9b
2 changed files with 9 additions and 2 deletions

View file

@ -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')

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([new_domain], web=True)
domain_add([new_domain], web=True, main=True)
lemon_conf_lines = [
"$tmp->{'domain'} = '"+ new_domain +"';", # Replace Lemon domain