← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 380190] Re: openerp-server.py command only updates modules on first database

 

for v6.1, no time to fix for v6.0

** Changed in: openobject-server
   Importance: Undecided => Wishlist

** Changed in: openobject-server
       Status: New => Won't Fix

-- 
openerp-server.py command only updates modules on first database
https://bugs.launchpad.net/bugs/380190
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Server: Won't Fix

Bug description:
When starting openerp-server with options such as --database=database1,database2 --update=module1, it only updates the first database. I have found what I think is the issue and made corrections on: openerp-server.py and addons/__init__.py

openerp-server:
#----------------------------------------------------------
# Load and update databases if requested
#----------------------------------------------------------

#Emilio Arrufat
to_init = tools.config['init']
to_update = tools.config['update']
#End Emilio
if tools.config['db_name']:
for db in tools.config['db_name'].split(','):
#Emilio Arrufat: original line:
#pooler.get_db_and_pool(db, update_module=tools.config['init'] or tools.config['update'])
#changed by:
pooler.get_db_and_pool(db, update_module=to_init or to_update)

the reason for that it seems to be on behavior of tools.config, since on the first call for the first database it returns a dictionary such as {module1:1} but on the second it returns an empty one; on receiving an empty dictionary following functions do nothing. 


addons/__init__.py:
function: load_modules(db, force_demo=False, status=None, update_module=False) 

it receives the module list in update_module parameter but then tries to iterate to update each module in turn. Problem is that it does not use the update_module parameter to iterate but tools.config instead, again with behavior similar to above. I have changed these lines:

if update_module:
....
#Emilio Arrufat, original line:
#mods = [k for k in tools.config['init'] if tools.config['nit'][k]]
#changed by:
mods = [k for k in update_module if update_module[k]]
....
#Emilio Arrufat, original line:
#mods = [k for k in tools.config['update'] if tools.config['update'][k]]
#changed by:
mods = [k for k in update_module if update_module[k]] 

it seems at the beginning that it always will initialize followed by an update, but it is checked when filtering for the state of modules.

It seems to me a solution for the issue, a big one when needed to update an installation whith several databases. Hope some one could merge it to the trunk.

Cheers, 
Emilio Arrufat
emilio --at-- icetic.com