From 7d7556bca1e44abcea41fd251a31d4340910fd9e Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Tue, 30 Aug 2011 15:23:37 +0400 Subject: [PATCH] Add function for get cmdline param. --- pym/cl_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pym/cl_utils.py b/pym/cl_utils.py index 5fea955..6da750d 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -1339,3 +1339,17 @@ def getPasswdUsers(minId=1000,maxId=65000): sortUsers.sort() retList = ["root"] + sortUsers return retList + +def getCmdLineParam(paramName): + """Get value of param /proc/cmdline. If param not found then empty. + """ + cmdLine = '/proc/cmdline' + paramName = "%s="%paramName + params = \ + map(lambda x:x.partition('=')[2], + filter(lambda x:x.startswith(paramName), + readFile(cmdLine).split(' '))) + if params: + return params[-1] + else: + return ""