modify based on code inspection comments. - continue work in weekend.
This commit is contained in:
@@ -10,7 +10,7 @@ install_xml = '../xml/install.xml'
|
||||
config_xml = '../xml/config.xml'
|
||||
|
||||
def to_xml_attr(doc, node, cls, name):
|
||||
''' This method is called by to_xml. Its function is to create an attribute, and set its value based on Network data member
|
||||
''' This method is called by to_xml. Its function is to create an attribute, and set its value based on xml data member
|
||||
doc - xml document
|
||||
node - xml node
|
||||
cls - python class/python instance
|
||||
@@ -289,8 +289,13 @@ p_node - xml node (parent node) '''
|
||||
#ri_tk_cmd.py use
|
||||
@staticmethod
|
||||
def get_size(dev):
|
||||
# need fill
|
||||
pass
|
||||
''' get raid device size '''
|
||||
rd = Raid.dict[dev]
|
||||
sz = min([ Partition.dict[d].size for d in rd.active_components])
|
||||
if rd.level == '0': return sz*len(rd.active_components)
|
||||
elif rd.level == '1': return sz
|
||||
elif rd.level == '5': return sz*len(rd.active_components) #???
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_next_device():
|
||||
@@ -383,6 +388,14 @@ p_node - xml node (parent node)'''
|
||||
mps.appendChild(mp)
|
||||
p_node.appendChild(mps)
|
||||
|
||||
@staticmethod
|
||||
def get_size(dev):
|
||||
'''get size of this mount point '''
|
||||
if dev in Partition.dict.keys():
|
||||
return Partition.get_size(dev)
|
||||
elif dev in Raid.dict.keys():
|
||||
return Raid.get_size(dev)
|
||||
|
||||
class Network:
|
||||
''' network '''
|
||||
hostname =''
|
||||
@@ -527,6 +540,20 @@ p_node - xml node (parent node)'''
|
||||
grp.appendChild(optl)
|
||||
grps.appendChild(grp)
|
||||
p_node.appendChild(grps)
|
||||
@staticmethod
|
||||
def get_install_pkgs():
|
||||
''' get package names that should be installed '''
|
||||
l = []
|
||||
for g in Group.dict.values():
|
||||
if g.install != 'no':
|
||||
l.extend([ p for p in g.mandatory ])
|
||||
if g.selection == 'manual':
|
||||
l.extend([ p[0] for p in g.optional if p[1] == 'yes' ])
|
||||
elif g.selection == 'all':
|
||||
l.extend([ p[0] for p in g.optional ])
|
||||
else: # selection is 'none'
|
||||
pass
|
||||
return l
|
||||
|
||||
class Service:
|
||||
''' service '''
|
||||
@@ -564,16 +591,7 @@ p - pkg, that includes this service
|
||||
def change_state():
|
||||
''' Based on package information in Group class, change 'start' data member
|
||||
from 'disable' to 'no', or from 'yes'/'no' to 'disable' '''
|
||||
l = []
|
||||
for g in Group.dict.values():
|
||||
if g.install == 'mandatory' or g.install == 'yes':
|
||||
l.extend(g.mandatory)
|
||||
if g.selection == 'all':
|
||||
l.extend([ n for n, i in g.optional])
|
||||
elif g.selection == 'manual':
|
||||
l.extend([ n for n, i in g.optional if i == 'yes'])
|
||||
else: # selection is 'none'
|
||||
pass
|
||||
l = Group.get_install_pkgs()
|
||||
|
||||
for s in Service.list:
|
||||
if s.package in l:
|
||||
|
||||
Reference in New Issue
Block a user