diff --git a/yunohost.py b/yunohost.py index 7bf1ece5..d4bae087 100644 --- a/yunohost.py +++ b/yunohost.py @@ -199,6 +199,7 @@ def lemon_configuration(conf_dict): line = line +"->{'"+ level +"'}" if value is None: conf_lines.append(line +';') + elif isinstance(value, int): conf_lines.append(line +' = '+ str(value) +';') else: conf_lines.append(line +' = \''+ value +'\';') diff --git a/yunohost_app.py b/yunohost_app.py index 39995076..0d3e2efa 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -307,7 +307,8 @@ def app_install(app, domain, path='/', label=None, mode='private'): ########## a2_conf_lines = [ - 'Alias '+ path +' '+ app_final_path + manifest['launch_path'] + 'Alias '+ path +' '+ app_final_path + manifest['launch_path'], + 'Alias '+ path[:len(path)-1] +' '+ app_final_path + manifest['launch_path'] ] if lvl(manifest, 'yunohost', 'webapp', 'language') and manifest['yunohost']['webapp']['language'] == 'php': diff --git a/yunohost_domain.py b/yunohost_domain.py index 8fae0f05..c6872901 100644 --- a/yunohost_domain.py +++ b/yunohost_domain.py @@ -68,15 +68,28 @@ def domain_add(domains, web=False): domains = [ domains ] for domain in domains: + if web: + lemon_configuration({ + ('exportedHeaders', domain, 'Auth-User'): '$uid', + ('exportedHeaders', domain, 'Remote-User'): '$uid', + ('exportedHeaders', domain, 'Desc'): '$description', + ('exportedHeaders', domain, 'Email'): '$mail', + ('exportedHeaders', domain, 'Name'): '$cn', + ('exportedHeaders', domain, 'Authorization'): '"Basic ".encode_base64("$uid:$_password")', + ('vhostOptions', domain, 'vhostMaintenance'): 0, + ('vhostOptions', domain, 'vhostPort'): -1, + ('vhostOptions', domain, 'vhostHttps'): -1, + ('locationRules', domain, 'default'): 'accept', + ('locationRules', domain, '(?#logout)^/logout'): 'logout_app_sso https://'+ domain +'/' + }) + _apache_config(domain) + try: yldap.validate_uniqueness({ 'virtualdomain' : domain }) except YunoHostError: if web: - _apache_config(domain) - _lemon_config(domain) - win_msg(_("Web config created")) - break + return else: raise YunoHostError(17, _("Domain already created")) @@ -117,9 +130,6 @@ def domain_add(domains, web=False): for line in conf_lines: conf.write(line + '\n') - if web: - _apache_config(domain) - _lemon_config(domain) if yldap.add('virtualdomain=' + domain + ',ou=domains', attr_dict): result.append(domain) @@ -197,39 +207,3 @@ def _apache_config(domain): else: raise YunoHostError(1, _("An error occured during Apache configuration")) - -def _lemon_config(domain): - """ - Configure LemonLDAP - - Keyword arguments: - domain -- Domain to configure LemonLDAP around - - """ - if os.path.exists(lemon_tmp_conf): os.remove(lemon_tmp_conf) - - lemon_conf_lines = [ - "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Auth-User'} = '$uid';", - "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Remote-User'} = '$uid';", - "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Desc'} = '$description';", - "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Email'} = '$mail';", - "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Name'} = '$cn';", - "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Authorization'} = '\"Basic \".encode_base64(\"$uid:$_password\")';", - "$tmp->{'vhostOptions'}->{'"+ domain +"'}->{'vhostMaintenance'} = 0;", - "$tmp->{'vhostOptions'}->{'"+ domain +"'}->{'vhostPort'} = -1;", - "$tmp->{'vhostOptions'}->{'"+ domain +"'}->{'vhostHttps'} = -1;", - "$tmp->{'locationRules'}->{'"+ domain +"'}->{'default'} = 'accept';", - "$tmp->{'locationRules'}->{'"+ domain +"'}->{'(?#logout)^/logout'} = 'logout_app_sso https://"+ domain +"/';", - ] - - with open(lemon_tmp_conf,'w') as lemon_conf: - for line in lemon_conf_lines: - lemon_conf.write(line + '\n') - - if os.system('/usr/share/lemonldap-ng/bin/lmYnhMoulinette') == 0: - win_msg(_("LemonLDAP configured")) - else: - raise YunoHostError(1, _("An error occured during LemonLDAP configuration")) - - -