diff options
| author | Christophe Monniez <moc@odoo.com> | 2017-11-08 15:55:51 +0100 |
|---|---|---|
| committer | Christophe Monniez <moc@odoo.com> | 2017-11-09 13:25:16 +0100 |
| commit | b2a126da843ee3ded68d6c8b984990ae1c7b84c6 (patch) | |
| tree | 83ae7325b14657429d26419f7d69fc4c598bb9f9 /odoo/cli/server.py | |
| parent | 938fca4de1ee80d5a77428caebcacf70f559a4d8 (diff) | |
[IMP] server,db: coherently handle PGUSER env variable
When Odoo is started with a db_user using 'postgres', the process
exits with a status 1. However, this can be bypassed when the
PGUSER environment variable is used.
This commit will prevent the usage of the 'postgres' for the
environment variable too.
Also, when trying to list db's, various methods where used to find a
suitable postgres user to get this list.
In fact, as the db cursor is available, a user is already at work.
So, in order to avoid code duplication (e.g. verify user from
environment variables), this commit removes those various method
and get the db user from the cursor.
Diffstat (limited to 'odoo/cli/server.py')
| -rw-r--r-- | odoo/cli/server.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/cli/server.py b/odoo/cli/server.py index 7c6ccd30b54..87d09cce4b7 100644 --- a/odoo/cli/server.py +++ b/odoo/cli/server.py @@ -46,7 +46,7 @@ def check_postgres_user(): This function assumes the configuration has been initialized. """ config = odoo.tools.config - if config['db_user'] == 'postgres': + if (config['db_user'] or os.environ.get('PGUSER')) == 'postgres': sys.stderr.write("Using the database user 'postgres' is a security risk, aborting.") sys.exit(1) |
