summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
Diffstat (limited to 'setup')
-rwxr-xr-xsetup/package.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/setup/package.py b/setup/package.py
index 18bc5559a9b..b21768d8abe 100755
--- a/setup/package.py
+++ b/setup/package.py
@@ -40,6 +40,14 @@ USER odoo
""" % {'group_id': os.getgid(), 'user_id': os.getuid()}
+class OdooTestTimeoutError(Exception):
+ pass
+
+
+class OdooTestError(Exception):
+ pass
+
+
def run_cmd(cmd, chdir=None, timeout=None):
logging.info("Running command %s", cmd)
return subprocess.run(cmd, cwd=chdir, timeout=timeout)
@@ -60,12 +68,12 @@ def _rpc_count_modules(addr='http://127.0.0.1', port=8069, dbname='mycompany'):
)
if toinstallmodules:
logging.error("Package test: FAILED. Not able to install dependencies of base.")
- raise Exception("Installation of package failed")
+ raise OdooTestError("Installation of package failed")
else:
logging.info("Package test: successfuly installed %s modules" % len(modules))
else:
logging.error("Package test: FAILED. Not able to install base.")
- raise Exception("Package test: FAILED. Not able to install base.")
+ raise OdooTestError("Package test: FAILED. Not able to install base.")
def publish(args, pub_type, extensions):
@@ -184,14 +192,6 @@ def _prepare_build_dir(args, win32=False):
# Docker stuffs
-class OdooTestTimeoutError(Exception):
- pass
-
-
-class OdooTestError(Exception):
- pass
-
-
class Docker():
"""Base Docker class. Must be inherited by specific Docker builder class"""
arch = None
@@ -265,8 +265,10 @@ class Docker():
while self.is_running() and (time.time() - start_time) < INSTALL_TIMEOUT:
time.sleep(5)
if os.path.exists(os.path.join(args.build_dir, 'odoo.pid')):
- _rpc_count_modules(port=self.exposed_port)
- self.stop()
+ try:
+ _rpc_count_modules(port=self.exposed_port)
+ finally:
+ self.stop()
return
if self.is_running():
self.stop()