aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Barabas <peter.barabas@ericsson.com>2016-03-10 13:14:53 +0100
committerPeter Barabas <peter.barabas@ericsson.com>2016-03-10 13:14:53 +0100
commitbefc84a9d28663a45510c71119980e1cf5b6eeca (patch)
treeae8d3799a44dd6539555b1e39bf456a62d4ede01
parentdb16151c8979fa76a35f4bf684ec64bd4e229a4e (diff)
Get user id without forking a shell.
Change-Id: I6789b81186b7ede124a838a5b6668ba8326e0c0b Signed-off-by: Peter Barabas <peter.barabas@ericsson.com>
-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')