Skip to content

Commit

Permalink
Fixing issue marklogic-community#535: Search for forest names in clean
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jmeekhof committed Oct 7, 2015
1 parent e624cee commit 5d62381
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 5d62381

Please sign in to comment.