Files
new_install/interface/test_data.py
Peng Zhihui cc0dd53024 Rename xml/config.xml to xml/install_cfg.xml
modified:   interface/ri_data.py
	modified:   interface/test_data.py
	modified:   main/setup
	modified:   text/ri_newt.py
	modified:   xml/dependency.xml
	renamed:    xml/config.xml -> xml/install_cfg.xml
2014-03-03 10:15:27 +08:00

49 lines
1.4 KiB
Python

#!/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)
elif e.nodeName == 'groups':
Group.init_from_install_xml(e)
# elif e.nodeName == 'services':
# Service.init_from_install_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)
Group.to_xml(xmldoc2, root2)
#Group.to_xml(xmldoc2, root2)
xmldoc_cfg = minidom.parse('./install_cfg.xml')
root_cfg = xmldoc_cfg.firstChild
#Group.init_from_config_xml(root_cfg)
#Group.to_xml(xmldoc2, root2)
Service.init_from_config_xml(root_cfg)
Service.to_xml(xmldoc2, root2)
PrettyPrint(xmldoc2)