From: Peter Barabas Date: Thu, 10 Mar 2016 12:14:53 +0000 (+0100) Subject: Get user id without forking a shell. X-Git-Tag: brahmaputra.3.0~15^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F07%2F12107%2F1;p=fuel.git Get user id without forking a shell. Change-Id: I6789b81186b7ede124a838a5b6668ba8326e0c0b Signed-off-by: Peter Barabas (cherry picked from commit befc84a9d28663a45510c71119980e1cf5b6eeca) --- diff --git a/deploy/common.py b/deploy/common.py index cc418b59b..787a21a1d 100644 --- a/deploy/common.py +++ b/deploy/common.py @@ -133,8 +133,8 @@ def commafy(comma_separated_list): def check_if_root(): - r = exec_cmd('whoami') - if r != 'root': + uid = os.getuid() + if uid != 0: err('You need be root to run this application')