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?

-----

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: [email protected]
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: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to