yunohost.domain: Fix domain removing if app has no 'domain' setting

This commit is contained in:
Jerome Lebleu 2014-04-01 14:43:43 +02:00
parent d766ed5a5e
commit 30d6ace802

View file

@ -256,8 +256,13 @@ def domain_remove(auth, domains):
# Check if apps are installed on the domain # Check if apps are installed on the domain
for app in os.listdir('/etc/yunohost/apps/'): for app in os.listdir('/etc/yunohost/apps/'):
with open('/etc/yunohost/apps/' + app +'/settings.yml') as f: with open('/etc/yunohost/apps/' + app +'/settings.yml') as f:
if yaml.load(f)['domain'] == domain: try:
raise MoulinetteError(1, _("One or more apps are installed on this domain, please uninstall them before proceed to domain removal")) app_domain = yaml.load(f)['domain']
except:
continue
else:
if app_domain == domain:
raise MoulinetteError(1, _("One or more apps are installed on this domain, please uninstall them before proceed to domain removal"))
if auth.remove('virtualdomain=' + domain + ',ou=domains'): if auth.remove('virtualdomain=' + domain + ',ou=domains'):
try: try: