From c650d776b3455465b72bae140698bac1e0323c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 12 Oct 2015 21:56:07 -0300 Subject: [PATCH] opt-in ENABLE_POSTGRES_USER for Docker usage #63 This new env var enables to skip the postgres user check. This can be handy when linking to some default Postgres containers. See https://github.com/anybox/anybox.recipe.odoo/issues/63 --- anybox/recipe/odoo/runtime/session.py | 3 ++- doc/scripts.rst | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/anybox/recipe/odoo/runtime/session.py b/anybox/recipe/odoo/runtime/session.py index 9161e8fa..457d9be4 100644 --- a/anybox/recipe/odoo/runtime/session.py +++ b/anybox/recipe/odoo/runtime/session.py @@ -162,7 +162,8 @@ def open(self, db=None, with_demo=False): cr.close() startup.check_root_user() - startup.check_postgres_user() + if not os.environ.get('ENABLE_POSTGRES_USER'): + startup.check_postgres_user() openerp.netsvc.init_logger() saved_without_demo = config['without_demo'] diff --git a/doc/scripts.rst b/doc/scripts.rst index 95f8eb50..00d7a03d 100644 --- a/doc/scripts.rst +++ b/doc/scripts.rst @@ -248,6 +248,14 @@ object is available for interacting with your odoo application and database. Keep in mind that ``bpython`` requires more system dependencies installed than plain ``odoo``. +Note that Odoo forbids using the ``postgres`` user to connect to the database. +But in some containerized environments (Docker), using ``postgres`` can be +both safe and handy. In such case you would need to patch the Odoo server as +of today. But for the interactives sessions of this buildout recipe, you can +set the environment variable ENABLE_POSTGRES_USER=1 before opening the console +to disable the default ``check_postgres_user()`` guard and enable the postgres +user. + Writing Odoo Scripts ~~~~~~~~~~~~~~~~~~~~