From 5d62381b624ce7dbcf2745d5e462c24e00182403 Mon Sep 17 00:00:00 2001 From: Josh Meekhof Date: Thu, 1 Oct 2015 11:55:29 -0400 Subject: [PATCH] Fixing issue #535: Search for forest names in clean clean command was failing when cleaning an enviroment that wasn't originally bootstrapped by roxy. I modified the clean_modules routine to search for forests associated with the modules database instead of assuming the default forest name. --- deploy/lib/server_config.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deploy/lib/server_config.rb b/deploy/lib/server_config.rb index e9563d5f..39fe885e 100644 --- a/deploy/lib/server_config.rb +++ b/deploy/lib/server_config.rb @@ -1699,7 +1699,14 @@ def deploy_schemas def clean_modules logger.info "Cleaning #{@properties['ml.modules-db']} on #{@hostname}" - execute_query %Q{xdmp:forest-clear(xdmp:forest("#{@properties['ml.modules-db']}"))} + + r = execute_query %Q{ + for $id in xdmp:database-forests(xdmp:database("#{@properties['ml.modules-db']}")) + return + try { xdmp:forest-clear($id) } catch ($ignore) { fn:concat("Skipped forest ", xdmp:forest-name($id), "..") } + } + r.body = parse_json(r.body) + logger.info r.body if @properties['ml.test-modules-db'].present? && @properties['ml.test-modules-db'] != @properties['ml.modules-db'] logger.info "Cleaning #{@properties['ml.test-modules-db']} on #{@hostname}"