Author: jsuchome Date: Thu May 5 17:42:45 2011 New Revision: 63915 URL: http://svn.opensuse.org/viewcvs/yast?rev=63915&view=rev Log: call initialization first Modified: trunk/snapper/src/Snapper.ycp Modified: trunk/snapper/src/Snapper.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/src/Snapper.ycp?rev=63915&r1=63914&r2=63915&view=diff ============================================================================== --- trunk/snapper/src/Snapper.ycp (original) +++ trunk/snapper/src/Snapper.ycp Thu May 5 17:42:45 2011 @@ -37,6 +37,7 @@ import "FileUtils"; import "Label"; import "Progress"; +import "Report"; // global list of all snapshot @@ -163,6 +164,41 @@ return true; } +global map LastSnapperErrorMap () { + + return (map) SCR::Read (.snapper.error); +} + +/** + * Initialize snapper agent + * Return true on success + */ +global boolean InitializeSnapper () { + + boolean init = (boolean) SCR::Execute (.snapper); + if (!init) + { + map err_map = LastSnapperErrorMap (); + string type = err_map["type"]:""; + string details = _("Reason not known."); + if (type == "config_not_found") + { + details = _("Configuration not found."); + } + else if (type == "config_invalid") + { + details = _("Configuration is not valid."); + } + + y2warning ("init failed with '%1'", err_map); + // error popup + Report::Error (sformat (_("Failed to initialize snapper library: +%1"), details)); + } + return init; + +} + /** * Read all snapper settings * @return true on success @@ -188,7 +224,11 @@ ); Progress::NextStage(); - // read database + + if (!InitializeSnapper ()) + { + return false; + } ReadSnapshots (); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org