continue on ri_data.py

add mount-points and group handling
This commit is contained in:
lizhi-rocky
2010-07-21 17:21:06 +08:00
parent 3ef7daf59a
commit c3e59e063f
4 changed files with 512 additions and 80 deletions

38
python/mine/test_data.py Normal file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/python
from ri_data import *
from xml.dom import minidom
from xml.dom.ext import PrettyPrint
xmldoc = minidom.parse('./i.xml')
root = xmldoc.firstChild
for e in root.childNodes:
if e.nodeType == e.ELEMENT_NODE:
if e.nodeName == 'serial-number':
SerialNumber.init_from_xml(e)
elif e.nodeName == 'partitions':
Partition.init_from_xml(e)
elif e.nodeName == 'raids':
Raid.init_from_xml(e)
elif e.nodeName == 'mount-points':
MountPoint.init_from_xml(e)
elif e.nodeName == 'network':
Network.init_from_xml(e)
xmldoc2 = minidom.Document()
root2 = xmldoc2.createElement('install')
xmldoc2.appendChild(root2)
SerialNumber.to_xml(xmldoc2, root2)
Partition.to_xml(xmldoc2, root2)
Raid.to_xml(xmldoc2, root2)
# test MountPoint.init_from_internal
MountPoint.list=[]
MountPoint.init_from_internal()
MountPoint.to_xml(xmldoc2, root2)
Network.to_xml(xmldoc2, root2)
PrettyPrint(xmldoc2)