Metronome conf

This commit is contained in:
Kload 2013-06-09 13:12:21 +00:00
parent cecbe3d293
commit 227cafa7a1
2 changed files with 18 additions and 2 deletions

View file

@ -173,10 +173,10 @@ domain:
help: Domain name to add
nargs: '+'
pattern: '^([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])*)$'
web:
-w:
full: --web
help: Auto-configure Apache and LemonLDAP for the domain
action: store_true
default: False
### domain_remove()
remove:

View file

@ -155,6 +155,22 @@ def domain_add(domains, web=False):
os.system('service bind9 reload')
# XMPP
try:
with open('/etc/metronome/conf.d/'+ domain +'.cfg.lua') as f: pass
except IOError as e:
conf_lines = [
'VirtualHost "'+ domain +'"',
' authentication = "ldap2"',
]
with open('/etc/metronome/conf.d/' + domain + '.cfg.lua', 'w') as conf:
for line in conf_lines:
conf.write(line + '\n')
os.system('mkdir -p /var/lib/metronome/'+ domain.replace('.', '%2e') +'/pep')
os.system('chown -R metronome: /var/lib/metronome/')
os.system('service metronome reload')
if yldap.add('virtualdomain=' + domain + ',ou=domains', attr_dict):
result.append(domain)
continue