[IMP] quality_integration_server: added net_port option in script
authorHarry (Open ERP) <hmo@tinyerp.com>
Fri, 27 Nov 2009 06:43:46 +0000 (12:13 +0530)
committerHarry (Open ERP) <hmo@tinyerp.com>
Fri, 27 Nov 2009 06:43:46 +0000 (12:13 +0530)
bzr revid: hmo@tinyerp.com-20091127064346-xlxow28w0y7sdk05

Makefile
bin/addons/quality_integration_server/base_quality_interrogation.py

index 7b410d1..b4a57c2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,31 +14,30 @@ login := admin
 password := admin
 
 start:        
-       python $(interrogation_file) start-server --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port)
+       python $(interrogation_file) start-server --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --net_port=$(net_port)
 
 create-db:
-       python $(interrogation_file) create-db --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --login=$(login) --password=$(password)
+       python $(interrogation_file) create-db --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --net_port=$(net_port) --login=$(login) --password=$(password)
 
 drop-db:
-       python $(interrogation_file) drop-db --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port)
+       python $(interrogation_file) drop-db --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --net_port=$(net_port)
 
 install-module:        
-       python $(interrogation_file) install-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --extra-addons=$(extra-addons) --port=$(port) --login=$(login) --password=$(password)
+       python $(interrogation_file) install-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --extra-addons=$(extra-addons) --net_port=$(net_port) --port=$(port) --login=$(login) --password=$(password)
 
 upgrade-module:        
-       python $(interrogation_file) upgrade-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --login=$(login) --password=$(password)
+       python $(interrogation_file) upgrade-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --net_port=$(net_port) --login=$(login)  --password=$(password)
        
 
 install-translation:    
-       python $(interrogation_file) install-translation --database=$(database) --translate-in=$(i18n-import) --port=$(port) --login=$(login) --password=$(password) --root-path=$(root-path) --addons-path=$(addons-path)
+       python $(interrogation_file) install-translation --database=$(database) --translate-in=$(i18n-import) --net_port=$(net_port) --port=$(port) --login=$(login) --password=$(password) --root-path=$(root-path) --addons-path=$(addons-path)
     
 
 version:
        python bin/openerp-server.py --version
 
 check-quality: 
-       python $(interrogation_file) check-quality --database=$(database) --modules=$(module) --port=$(port) --login=$(login) --password=$(password) --addons-path=$(addons-path) --root-path=$(root-path)
+       python $(interrogation_file) check-quality --database=$(database) --modules=$(module)  --net_port=$(net_port)        --port=$(port) --login=$(login) --password=$(password) --addons-path=$(addons-path) --root-path=$(root-path)
        
 
 
-
index 7da74e7..eb141b0 100755 (executable)
@@ -49,8 +49,8 @@ def to_decode(s):
             except UnicodeError:
                 return s
 
-def start_server(root_path, port, addons_path):
-    os.system('python2.5 %sopenerp-server.py  --pidfile=openerp.pid  --port=%s --no-netrpc --addons-path=%s' %(root_path, str(port), addons_path))
+def start_server(root_path, port, netport, addons_path):
+    os.system('python2.5 %sopenerp-server.py  --pidfile=openerp.pid  --port=%s --net_port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path))
 def clean():
     if os.path.isfile('openerp.pid'):
         ps = open('openerp.pid')
@@ -209,20 +209,23 @@ def drop_db(uri, dbname):
 def make_links(uri, uid, dbname, source, destination, module, user, pwd):
     if module in ('base','quality_integration_server'):
         return True
-    if not os.path.islink(destination + '/' + module):
-        if not os.path.isdir(destination + '/' + module):
-            for path in source:
-                if os.path.isdir(path + '/' + module):
-                    os.symlink(path + '/' + module, destination + '/' + module)
-                    obj_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/object')
-                    execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'update_list')
-                    module_ids = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'search', [('name','=',module)])
-                    if len(module_ids):
-                        data = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'read', module_ids[0],['name','dependencies_id'])
-                        dep_datas = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module.dependency', 'read', data['dependencies_id'],['name'])
-                        for dep_data in dep_datas:
-                            make_links(uri, uid, dbname, source, destination, dep_data['name'], user, pwd)
-                    return True
+    for path in source:
+        if os.path.isdir(path + '/' + module):
+            if not os.path.islink(destination + '/' + module):
+                os.symlink(path + '/' + module, destination + '/' + module)
+                obj_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/object')
+                execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'update_list')
+                module_ids = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'search', [('name','=',module)])
+                if len(module_ids):
+                    data = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'read', module_ids[0],['name','dependencies_id'])
+                    dep_datas = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module.dependency', 'read', data['dependencies_id'],['name'])
+                    for dep_data in dep_datas:
+                        make_links(uri, uid, dbname, source, destination, dep_data['name'], user, pwd)
+                break
+        else:
+            if os.path.islink(destination + '/' + module):
+               os.unlink(destination + '/' + module)
+               break
     return False
 
 def install_module(uri, dbname, modules, addons='', extra_addons='',  user='admin', pwd='admin'):
@@ -292,6 +295,7 @@ parser.add_option("--addons-path", dest="addons_path", help="specify the addons
 parser.add_option("--quality-logs", dest="quality_logs", help="specify the path of quality logs files which has to stores")
 parser.add_option("--root-path", dest="root_path", help="specify the root path")
 parser.add_option("-p", "--port", dest="port", help="specify the TCP port", type="int")
+parser.add_option("--net_port", dest="netport",help="specify the TCP port for netrpc")
 parser.add_option("-d", "--database", dest="db_name", help="specify the database name")
 parser.add_option("--login", dest="login", help="specify the User Login")
 parser.add_option("--password", dest="pwd", help="specify the User Password")
@@ -324,6 +328,7 @@ options = {
     'root-path' : opt.root_path or '',
     'translate-in': [],
     'port' : opt.port or 8069,
+    'netport':opt.netport or 8070,
     'database': opt.db_name or 'terp',
     'modules' : opt.modules or [],
     'login' : opt.login or 'admin',
@@ -346,7 +351,7 @@ if opt.translate_in:
 uri = 'http://localhost:' + str(options['port'])
 
 server_thread = threading.Thread(target=start_server,
-                args=(options['root-path'], options['port'], options['addons-path']))
+                args=(options['root-path'], options['port'],options['netport'], options['addons-path']))
 try:
     server_thread.start()
     if command == 'create-db':