Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

clean modules fails for environments not originally bootstrapped by roxy #535

@jmeekhof

Description

@jmeekhof

I'm working in an environment that wasn't originally initialized by roxy. In our environment we have 1 forest for each host on our modules database. Since roxy assumes there's only 1 forest with fixed name the clean fails in our environment because the forest doesn't have the assumed name.
deploy/lib/server_config.rb

def clean_modules                                                                                                
  logger.info "Cleaning #{@properties['ml.modules-db']} on #{@hostname}"
  execute_query %Q{xdmp:forest-clear(xdmp:forest("#{@properties['ml.modules-db']}"))}   

If we borrow the logic from the clean content code, we assume less and it works regardless of how many forests are designated for the modules database.

def clean_modules
  logger.info "Cleaning #{@properties['ml.modules-db']} on #{@hostname}"                                         
  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 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions