Merge branch 'zli-tmp' into zli

Conflicts:
	interface/ri_data.py
This commit is contained in:
lizhi-rocky
2010-10-18 11:02:43 +08:00
4 changed files with 88 additions and 95 deletions

View File

@@ -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
@@ -392,6 +392,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 =''
@@ -536,6 +544,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 '''
@@ -573,16 +595,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: