Hi,
looking at the log produced by running yast with Y2DEBUG set to 1 I
realized that it contained enough information to write a debugger that
parses it.
I saw the announcement of the ycp debugger and must admit that I
haven't looked at it. But working with the recorded trace allows some
fancy stuff like walking backwards and it's written in python so it is
easily hackable.
Well, here it is, it served me well and it might be useful for someone
else. Feel free to put it in the repository if you like.
Justus
~~~ snip ~~~
$ Y2DEBUG=1 /usr/lib/YaST2/bin/y2base -l - -c /usr/share/YaST2/data/testsuite/log.conf -I ../src -M ../src tests/Network_YaPI.ycp UI 2> log
$ ycppmd.py log
[...]
pmd> display Devs OriginalDevs
1: 2011-08-30 10:54:26 <0> opensuse(21525) [libycp] pathsearch.cc(getPaths):68 getPaths /y2update /root/.yast2 /usr/share/YaST2
Devs = UNDEFINED
OriginalDevs = UNDEFINED
[...]
pmd> goto 38176
38176: 2011-08-30 10:54:29 <0> opensuse(21525) [liby2] SymbolEntry.cc(setValue):107 SymbolEntry::setValue (Devs@0x1507900 = '$["eth":$["eth0":$["BOOTPROTO":"dhcp4", "STARTMODE":""], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4", "MTU":"1234", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7/24", "STARTMODE":"auto"], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth5":$["BOOTPROTO":"static", "STARTMODE":""]], "vlan":$["eth5.23":$["BOOTPROTO":"static", "IPADDR":"1.2.3.8/24", "STARTMODE":"auto"]]]')
Devs = $["eth":$["eth0":$["BOOTPROTO":"dhcp4", "STARTMODE":""], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4", "MTU":"1234", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7/24", "STARTMODE":"auto"], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth5":$["BOOTPROTO":"static", "STARTMODE":""]], "vlan":$["eth5.23":$["BOOTPROTO":"static", "IPADDR":"1.2.3.8/24", "STARTMODE":"auto"]]]
OriginalDevs = UNDEFINED
[...]
pmd> bt full
0 - [main]
{'READ': '$["init":$["scripts":$["exists":false]], "network":$["section":$["eth0":$[], "eth1":$[], "eth2":$[], "eth3":$[], "eth4":$[], "eth5":$[], "eth5.23":$[]], "value":$["eth0":$["BOOTPROTO":"dhcp4"], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4/24", "MTU":"1234"], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5/24", "PREFIXLEN":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.6", "PREFIXLEN":"24"], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0"], "eth5":$["BOOTPROTO":"static"], "eth5.23":$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8/24", "VLAN_ID":"23"]]], "routes":[$["destination":"default", "gateway":"10.20.30.40"]], "sysconfig":$["network":$["config":$["NETCONFIG_DNS_STATIC_SEARCHLIST":"suse.cz suse.de", "NETCONFIG_DNS_STATIC_SERVERS":"208.67.222.222 208.67.220.220"], "dhcp":$["DHCLIENT_SET_HOSTNAME":"yes", "WRITE_HOSTNAME_TO_HOSTS":"no"]]], "target":$["bash_output":"laptop.suse.cz", "size":27, "string":"laptop.suse.cz"]]', 'dummy_log_string': '"LOGTHIS_SECRET_314 "', 'EXEC': '$["target":$["bash_output":$["exit":0, "stdout":"laptop.suse.cz"]]]'}
1 - TEST
{'FUNCTION': 'YaPI::NETWORK::Write ($["interface":$["eth5.23":$["bootproto":"static", "ipaddr":"1.2.3.8/24", "vlan_etherdevice":"eth5", "vlan_id":"42"]]])', 'INPUT': '[$["init":$["scripts":$["exists":false]], "network":$["section":$["eth0":$[], "eth1":$[], "eth2":$[], "eth3":$[], "eth4":$[], "eth5":$[], "eth5.23":$[]], "value":$["eth0":$["BOOTPROTO":"dhcp4"], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4/24", "MTU":"1234"], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5/24", "PREFIXLEN":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.6", "PREFIXLEN":"24"], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0"], "eth5":$["BOOTPROTO":"static"], "eth5.23":$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8/24", "VLAN_ID":"23"]]], "routes":[$["destination":"default", "gateway":"10.20.30.40"]], "sysconfig":$["network":$["config":$["NETCONFIG_DNS_STATIC_SEARCHLIST":"suse.cz suse.de", "NETCONFIG_DNS_STATIC_SERVERS":"208.67.222.222 208.67.220.220"], "dhcp":$["DHCLIENT_SET_HOSTNAME":"yes", "WRITE_HOSTNAME_TO_HOSTS":"no"]]], "target":$["bash_output":"laptop.suse.cz", "size":27, "string":"laptop.suse.cz"]]]', 'DEFAULT': 'nil'}
2 - Test
{'FUNCTION': 'YaPI::NETWORK::Write ($["interface":$["eth5.23":$["bootproto":"static", "ipaddr":"1.2.3.8/24", "vlan_etherdevice":"eth5", "vlan_id":"42"]]])', 'INPUT': '[$["init":$["scripts":$["exists":false]], "network":$["section":$["eth0":$[], "eth1":$[], "eth2":$[], "eth3":$[], "eth4":$[], "eth5":$[], "eth5.23":$[]], "value":$["eth0":$["BOOTPROTO":"dhcp4"], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4/24", "MTU":"1234"], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5/24", "PREFIXLEN":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.6", "PREFIXLEN":"24"], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0"], "eth5":$["BOOTPROTO":"static"], "eth5.23":$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8/24", "VLAN_ID":"23"]]], "routes":[$["destination":"default", "gateway":"10.20.30.40"]], "sysconfig":$["network":$["config":$["NETCONFIG_DNS_STATIC_SEARCHLIST":"suse.cz suse.de", "NETCONFIG_DNS_STATIC_SERVERS":"208.67.222.222 208.67.220.220"], "dhcp":$["DHCLIENT_SET_HOSTNAME":"yes", "WRITE_HOSTNAME_TO_HOSTS":"no"]]], "target":$["bash_output":"laptop.suse.cz", "size":27, "string":"laptop.suse.cz"]]]', 'real_ret': '$["error":"", "exit":"0"]', 'DEFAULT': 'nil'}
3 - Write
{'Current': '$[]', 'Name': '""', 'OriginalDevs': '$["eth":$["eth0":$["BOOTPROTO":"dhcp4", "STARTMODE":""], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4", "MTU":"1234", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.6", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth5":$["BOOTPROTO":"static", "STARTMODE":""]], "vlan":$["eth5.23":$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":"", "VLAN_ID":"23"]]]', 'devregex': '""', 'chmod': '[]', 'Devs': '$["eth":$["eth0":$["BOOTPROTO":"dhcp4", "STARTMODE":""], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4", "MTU":"1234", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7/24", "STARTMODE":"auto"], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth5":$["BOOTPROTO":"static", "STARTMODE":""]], "vlan":$["eth5.23":$["BOOTPROTO":"static", "IPADDR":"1.2.3.8/24", "STARTMODE":"auto"]]]', 'netmask': '"24"', 'has_key': 'false', 'file': '"/etc/sysconfig/network/ifcfg-eth5.23"', 'operation': 'nil', 'typ': '"vlan"', 'nm': '"^((128|192|224|240|248|252|254|255).0.0.0|255.(128|192|224|240|248|252|254|255).0.0|255.255.(128|192|224|240|248|252|254|255).0|255.255.255.(128|192|224|240|248|252|254|255))$"', 'devsmap': '$["eth5.23":$["BOOTPROTO":"static", "IPADDR":"1.2.3.8/24", "STARTMODE":"auto"]]', 'name': '"eth5.23"', 'service': '"network"', 's1': '"(128|192|224|240|248|252|254|255)"', 'devmap': '$["BOOTPROTO":"static", "IPADDR":"1.2.3.8/24", "STARTMODE":"auto"]', 'p': '".network.value.\\"eth5.23\\"."', 'config': '"eth5.23"', 'k': '"WIRELESS_KEY_3"'}
4 - ConcealSecrets
{'devs': '$["eth":$["eth0":$["BOOTPROTO":"dhcp4", "STARTMODE":""], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4", "MTU":"1234", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.6", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth5":$["BOOTPROTO":"static", "STARTMODE":""]], "vlan":$["eth5.23":$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":"", "VLAN_ID":"23"]]]', 'tout': '$["eth5.23":$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":"", "VLAN_ID":"23"]]', 'tdevs': '$["eth5.23":$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":"", "VLAN_ID":"23"]]', 'out': '$["eth":$["eth0":$["BOOTPROTO":"dhcp4", "STARTMODE":""], "eth1":$["BOOTPROTO":"static", "IPADDR":"1.2.3.4", "MTU":"1234", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth2":$["BOOTPROTO":"static", "IPADDR":"1.2.3.5", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth3":$["BOOTPROTO":"static", "IPADDR":"1.2.3.6", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth4":$["BOOTPROTO":"static", "IPADDR":"1.2.3.7", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":""], "eth5":$["BOOTPROTO":"static", "STARTMODE":""]], "vlan":$["eth5.23":$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":"", "VLAN_ID":"23"]]]', 'ifcfg': '$["BOOTPROTO":"static", "ETHERDEVICE":"eth5", "IPADDR":"1.2.3.8", "NETMASK":"255.255.255.0", "PREFIXLEN":"24", "STARTMODE":"", "VLAN_ID":"23"]', 'id': '"eth5.23"', 't': '"vlan"'}
38297: 2011-08-30 10:54:29 <0> opensuse(21525) [libycp] ExecutionEnvironment.cc(pushframe):105 Push frame ConcealSecrets1
--
Justus Winter winter(a)pre-sense.de
PRESENSE Technologies GmbH Sachsenstr. 5, D-20097 HH
USt-IdNr.: DE263765024
Geschäftsführer/Managing Directors AG Hamburg, HRB 107844
Till Dörges Jürgen Sander Axel Theilmann