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

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

Closed
jmeekhof opened this issue Oct 7, 2015 · 4 comments
Closed
Assignees
Milestone

Comments

@jmeekhof
Copy link
Contributor

jmeekhof commented Oct 7, 2015

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 
@joemfb joemfb mentioned this issue Oct 7, 2015
jmeekhof added a commit to jmeekhof/roxy that referenced this issue Oct 7, 2015
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.
jmeekhof added a commit to jmeekhof/roxy that referenced this issue Oct 7, 2015
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.
@jmeekhof
Copy link
Contributor Author

jmeekhof commented Oct 7, 2015

Joe,

I think I created my pull request correctly this time.

Josh

@jmeekhof jmeekhof closed this as completed Oct 7, 2015
@jmeekhof jmeekhof reopened this Oct 7, 2015
@grtjn
Copy link
Contributor

grtjn commented Oct 7, 2015

Nice find, last PR looks good..

@jmeekhof
Copy link
Contributor Author

jmeekhof commented Oct 8, 2015

Looking through the rest of the clean_ functions, the same issue remains for

clean_triggers
clean_schemas

Should we fix these as well?

jmeekhof added a commit to jmeekhof/roxy that referenced this issue Oct 8, 2015
Each of the clean_functions now searches for forests.
dmcassel added a commit that referenced this issue Nov 12, 2015
Fixing issue #535: Search for forest names in clean
grtjn pushed a commit to grtjn/roxy that referenced this issue Jan 28, 2016
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.
grtjn pushed a commit to grtjn/roxy that referenced this issue Jan 28, 2016
Each of the clean_functions now searches for forests.
@grtjn
Copy link
Contributor

grtjn commented Jun 14, 2017

Fixed in MASTER

@grtjn grtjn closed this as completed Jun 14, 2017
@grtjn grtjn added this to the July 2017 milestone Jun 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants