diff --git a/pym/cl_datavars.py b/pym/cl_datavars.py index fe80bad..3960735 100644 --- a/pym/cl_datavars.py +++ b/pym/cl_datavars.py @@ -17,6 +17,7 @@ import os import sys import cl_utils +import re from cl_lang import lang from cl_template import iniParser from cl_string import columnWrite @@ -700,3 +701,21 @@ class glob_attr: except IOError,e: return "" + def getValueFromConfig(self,config,name): + """Get value of parameter from bash type file + + Parameters: + config config file name + name param name + """ + reMatch = re.compile("^%s\s*=\s*\"?(.*)\"?$"%name, re.I) + try: + if os.path.exists(config): + for line in open(config,"r").readlines(): + match = reMatch.match(line) + if match: + return group().strip() + except: + pass + return False + diff --git a/pym/cl_fill.py b/pym/cl_fill.py index c809628..4c97066 100644 --- a/pym/cl_fill.py +++ b/pym/cl_fill.py @@ -513,24 +513,6 @@ class fillVars(glob_attr): break return virtName - def getValueFromConfig(self,config,name): - """Get value of parameter from bash type file - - Parameters: - config config file name - name param name - """ - reMatch = re.compile("^%s\s*=\s*\"?(.*)\"?$"%name, re.I) - try: - if os.path.exists(config): - for line in open(config,"r").readlines(): - match = reMatch.match(line) - if match: - return group().strip() - except: - pass - return False - def get_hr_board_model(self): """motherboard model""" modelFile = "/sys/class/dmi/id/board_name"