diff --git a/yunohost_domain.py b/yunohost_domain.py index d67113d6..c9f97e18 100644 --- a/yunohost_domain.py +++ b/yunohost_domain.py @@ -124,9 +124,10 @@ def domain_add(domains, raw=False, main=False): (('vhostOptions', domain, 'vhostMaintenance'), 0), (('vhostOptions', domain, 'vhostPort'), -1), (('vhostOptions', domain, 'vhostHttps'), -1), - (('locationRules', domain, 'default'), 'accept', apply=True) + (('locationRules', domain, 'default'), 'accept') ] for lemonrule in lemonrules: tools_lemonrule(*lemonrule) + tools_lemonrule(apply=True) _apache_config(domain) try: diff --git a/yunohost_tools.py b/yunohost_tools.py index 7a893b21..5ab0546e 100644 --- a/yunohost_tools.py +++ b/yunohost_tools.py @@ -166,21 +166,15 @@ def tools_maindomain(old_domain, new_domain, dyndns=False): domain_add([new_domain], raw=False, main=True) - lemonrules = [ - ('domain', new_domain), # Replace Lemon domain - ('ldapBase', 'dc=yunohost,dc=org'), # Set ldap basedn - ('portal', 'https://'+ new_domain +'/sso/'), # Set SSO url - (url=new_domain+'/ynh-admin/', value='$uid eq "admin"'), - (url=new_domain+'/ynh-user/', value='$uid ne "admin"') - ] + tools_lemonrule('domain', new_domain) # Replace Lemon domain + tools_lemonrule('ldapBase', 'dc=yunohost,dc=org') # Set ldap basedn + tools_lemonrule('portal', 'https://'+ new_domain +'/sso/') # Set SSO url + tools_lemonrule(url=new_domain+'/ynh-admin/', value='$uid eq "admin"') + tools_lemonrule(url=new_domain+'/ynh-user/', value='$uid ne "admin"') if old_domain is 'yunohost.org': - lemonrules.extend([ - (url=old_domain+'/ynh-admin/', delete=True), - (url=old_domain+'/ynh-user/', delete=True) - ]) - - for lemonrule in lemonrules: tools_lemonrule(*lemonrule) + tools_lemonrule(url=old_domain+'/ynh-admin/', delete=True) + tools_lemonrule(url=old_domain+'/ynh-user/', delete=True) os.system('rm /etc/yunohost/apache/domains/' + old_domain + '.d/*.fixed.conf') # remove SSO apache conf dir from old domain conf (fail if postinstall) os.system('rm /etc/ssl/private/yunohost_key.pem')