summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Barabas <peter.barabas@ericsson.com>2016-03-10 13:14:53 +0100
committerJonas Bjurel <jonas.bjurel@ericsson.com>2016-04-09 17:58:14 +0000
commit87559292c40ebb8563bad5ff829e560b02199f19 (patch)
treec9be3b2c449b1ecc83b04d34cc9b99b41e6779d0
parent0dc771a9584fe1998236c8941189b1afc3c3c066 (diff)
Get user id without forking a shell.
Change-Id: I6789b81186b7ede124a838a5b6668ba8326e0c0b Signed-off-by: Peter Barabas <peter.barabas@ericsson.com> (cherry picked from commit befc84a9d28663a45510c71119980e1cf5b6eeca)
-rw-r--r--deploy/common.py4
1 files changed, 2 insertions, 2 deletions
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')