Hi all,

I (with Schubi's help) have added a new logging facility into the YaST 
installer. It
dumps some data in YAML format into the /var/log/YaST2/installation_info/ 
directory.

Currently YaST writes the new logs when starting the installation and when
that "No base product found" error happens (that was actually the original 
reason
for creating this logging functionality).

But you can easily create a dump whenever you need, usually when something goes 
wrong:

  require "installation/installation_info"

  ::Installation::InstallationInfo.instance.write(
    "Setting foo option failed",
    additional_info: "File foo does not exist"
  )


The default dump contains some basic data (repositories, products....) but you 
can
easily extend the dumped data by calling:

  ::Installation::InstallationInfo.instance.add_callback("my_module") do
    {
      "foo" => foo.value,
      "bar" => bar.value
    }
  end

The data will be saved into the YAML file as key "my_module" with the data 
returned
by the block. The key should be unique to avoid collisions, a good idea is to 
use the
package name.

Note: avoid saving some sensitive private data like passwords or registration 
keys.
The dump files are also archived by the "save_y2logs" script and they might be
attached to bugzilla or sent my email...


Why using blocks? The block behaves like a callback, the advantage is that it is
evaluated at the time when writing the dump file. That ensures you always write 
the
current. Reading the y2log is difficult if user changes same values, goes
back and forth in the workflow..., having the current dump helps a lot in that 
cases.

That is also important for product selection because the libzypp products might
change whenever a repository is added or modified, the dependency solver might 
change
the selected products, etc...


See installation/installation_info.rb for more details:

https://github.com/yast/yast-yast2/blob/e9b29cf6ac80a2ef9148021c516f4e58e09d9123/library/general/src/lib/installation/installation_info.rb


Enjoy! :)

-- 
Ladislav Slezák
YaST Developer

SUSE LINUX, s.r.o.
Corso IIa
Křižíkova 148/34
18600 Praha 8

Reply via email to