From 4b35febec7b3d73196444918396a229fd5129ab7 Mon Sep 17 00:00:00 2001 From: Kload Date: Fri, 7 Jun 2013 12:26:54 +0000 Subject: [PATCH] So much perl in da world (+ remove script) --- action_map.yml | 1 + yunohost_app.py | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/action_map.yml b/action_map.yml index 8e6c3ce8..53c49294 100644 --- a/action_map.yml +++ b/action_map.yml @@ -292,6 +292,7 @@ app: arguments: app: help: App(s) to delete + ask: "App ID to remove" -i: full: --instance help: App instance number to delete diff --git a/yunohost_app.py b/yunohost_app.py index 10e8bb3a..de860bf1 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -613,8 +613,26 @@ def app_remove(app, instance=[]): is_web = lvl(manifest, 'yunohost', 'webapp') has_db = lvl(manifest, 'yunohost', 'webapp', 'db') + script_var_dict = { + 'APP_DIR': apps_path +'/'+ unique_app_id, + 'APP_ID': unique_app_id + } + + if lvl(manifest, 'dependencies'): + #_remove_app_dependencies(manifest['dependencies']) + pass + + if lvl(manifest, 'yunohost', 'script_path'): + _exec_app_script(step='remove', path=app_tmp_folder +'/'+ manifest['yunohost']['script_path'], var_dict=script_var_dict, app_type=manifest['type']) + if is_web: - lemon_conf_lines[('locationRules', app_settings['domain'], '(?#'+ unique_app_id +'Z)^'+ app_settings['path'] )] = None + if os.path.exists(lemon_tmp_conf): os.remove(lemon_tmp_conf) + + with open(lemon_tmp_conf,'a') as lemon_conf: + hash = "$tmp->{'locationRules'}->{'"+ app_settings['domain'] +"'}" + lemon_conf.write("foreach my $key (keys %{ "+ hash +" }) { delete "+ hash +"{$key} if $key =~ /"+ app_settings['uid'] +"/; }" + '\n') + + os.system('/usr/share/lemonldap-ng/bin/lmYnhMoulinette') try: os.remove(a2_settings_path +'/'+ app_settings['domain'] +'.d/'+ unique_app_id +'.app.conf') except OSError: