Fist of all enable mod_python in apache2, then configure Handler for Python.
Then write index.py with this code:
def getDescription():
import ycp
ycp.import_module('Lan')
ycp.import_module('LanItems')
ycp.Lan.Read(ycp.Term('nocache'))
interfaces=ycp.LanItems.Overview()
descr="<table>"
for interface in interfaces:
descr+="<tr><td>"+interface['table_descr'][0]+"</td>"
descr+="<td>"+interface['rich_descr']+"</td></tr>"
descr+="</table>"
return descr
def index():
s = """\
<html>
<body>
"""+getDescription()+"""
</body>
</html>
"""
return s
It needs some hack - disable check if YaST code is running as root. I commented one line in Lan::Read() function. And result is here:
PRO/Wireless 3945ABG Network Connection | PRO/Wireless 3945ABG Network Connection (Not connected) MAC : 00:18:de:64:b8:0d The device is not configured. Press Edit |
82573L Gigabit Ethernet Controller | 82573L Gigabit Ethernet Controller MAC : 00:16:41:aa:74:56
|
It's just summary of network devices configuration. I know it's very simple example, but as I wrote - the plan was to do it before lunch, not instead of ;-)
No comments:
Post a Comment