From cae7c71635f83cb16d36f2830b76deef46f55da4 Mon Sep 17 00:00:00 2001 From: Akram Ben Aissi Date: Sun, 19 Aug 2018 22:36:10 +0100 Subject: [PATCH] [IMP] cli: allows to run odoo with openshift For containers using random uids[1], use the higher level method getpass.getuser which as the same effect but also looks consider the environment variables to determine the user name. Details from http://blog.dscpl.com.au/2015/12/unknown-user-when-running-docker.html CLA signature for akram Closes #26452 [1] openshift or docker as explained at http://blog.dscpl.com.au/2015/12/random-user-ids-when-running-docker.html --- doc/cla/individual/akram.md | 9 +++++++++ odoo/cli/server.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 doc/cla/individual/akram.md diff --git a/doc/cla/individual/akram.md b/doc/cla/individual/akram.md new file mode 100644 index 00000000000..cce2725e329 --- /dev/null +++ b/doc/cla/individual/akram.md @@ -0,0 +1,9 @@ +France, 2018-08-19 + +I hereby agree to the terms of the Odoo Individual Contributor License Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this declaration. + +Signed, + +Akram Ben Aissi akram.benaissi@free.fr https://github.com/akram diff --git a/odoo/cli/server.py b/odoo/cli/server.py index 87d09cce4b7..8809cda542a 100644 --- a/odoo/cli/server.py +++ b/odoo/cli/server.py @@ -36,8 +36,8 @@ _logger = logging.getLogger('odoo') def check_root_user(): """Warn if the process's user is 'root' (on POSIX system).""" if os.name == 'posix': - import pwd - if pwd.getpwuid(os.getuid())[0] == 'root': + import getpass + if getpass.getuser() == 'root': sys.stderr.write("Running as user 'root' is a security risk.\n") def check_postgres_user():