From 227cafa7a12d7236de5ca69e2ec89b81143712df Mon Sep 17 00:00:00 2001 From: Kload Date: Sun, 9 Jun 2013 13:12:21 +0000 Subject: [PATCH] Metronome conf --- action_map.yml | 4 ++-- yunohost_domain.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/action_map.yml b/action_map.yml index 5ad0c8d2..994d95d3 100644 --- a/action_map.yml +++ b/action_map.yml @@ -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: diff --git a/yunohost_domain.py b/yunohost_domain.py index fd8bf3e9..180a03df 100644 --- a/yunohost_domain.py +++ b/yunohost_domain.py @@ -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