Move method getValueFromConfig from Fill to globattr

develop
Mike Hiretsky 14 years ago
parent ab4f58351e
commit 36ecb9f36c

@ -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

@ -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"

Loading…
Cancel
Save