On Thu, 25 Apr 2013 16:06:24 +0200 Ladislav Slezak <lslezak@suse.cz> wrote:
Dne 25.4.2013 12:40, Jiri Srain napsal(a):
Hi,
(sorry for top-posting)
Unfortunately, reading is not the only operation with the data - YaST also writes them quite extensively.
I don't really know what exactly the problem (internally) is, anyway, I have one suggstion:
Does reading/writing of the AutoYaST profiles, installation workflow definition and similar files work?
I tried the XML approach in the ntp-client, IMHO it looks better in this case, you can compare
https://github.com/yast/yast-ntp-client/pull/6/files (XML solution) https://github.com/yast/yast-ntp-client/pull/5/files (include file)
The advantage is that the data is XML file which can be read also by tools outside yast and it is a true data file (in contrast to include which is basically a piece of code).
Any opinions?
From my point of view it is fine as long as such file is automatic generated. I really don't want to write such beast manually :) even reading it is pain. Question is what happen during installation as you read it now directory and before agent is used, so does it read from same location in both cases? Josef
-----
P.S.: Here is the script which I used for creating the XML file:
{ // read "servers" content include "ntp-client/ntp_servers.ycp"; import "XML";
map doc = $[]; doc["cdataSections"] = []; doc["listEntries"] =$["ntp_servers":"ntp_server"];
doc["rootElement"] = "ntp_database"; doc["systemID"] = "/usr/share/YaST2/control/control.dtd"; doc["nameSpace"] = "http://www.suse.com/1.0/yast2ns"; doc["typeNamespace"] = "http://www.suse.com/1.0/configns"; XML::xmlCreateDoc(`ntp, doc);
XML::YCPToXMLFile(`ntp, $[ "ntp_servers" : servers], "/tmp/ntp.xml"); }
Then you can read the content by
{ import "XML"; y2internal("NTP: %1", XML::XMLToYCPFile("/tmp/ntp.xml")); }
(BTW I had to manually fix the YCP data as there were some XML entities which made troubles when parsing back the saved XML file.)
--
Best Regards
Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org