From c0d1cca028684b6c836002a725529011a13d5105 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Thu, 22 Dec 2011 11:44:19 +0100 Subject: [PATCH] At least warn if config file can not be parsed --- src/Config.cc | 3 ++- src/utils/Augeas.cc | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Config.cc b/src/Config.cc index 2ff66ad..3da52f4 100644 --- a/src/Config.cc +++ b/src/Config.cc @@ -302,6 +302,7 @@ void Config::read(const string & file) } catch (Exception & e) { - DBG << "Augeas exception. No config read, sticking with defaults." << endl; + std::cerr << e.asUserHistory() << endl; + std::cerr << "*** Augeas exception. No config read, sticking with defaults." << endl; } } diff --git a/src/utils/Augeas.cc b/src/utils/Augeas.cc index 238d84c..3320346 100644 --- a/src/utils/Augeas.cc +++ b/src/utils/Augeas.cc @@ -74,21 +74,23 @@ Augeas::Augeas(const string & file) _user_conf_path = "/files" + _homedir + "/.zypper.conf"; // global conf errors - _got_global_zypper_conf = - ::aug_get(_augeas, "/files/etc/zypp/zypper.conf", NULL) != 0; + _got_global_zypper_conf = ::aug_get(_augeas, "/files/etc/zypp/zypper.conf", NULL) != 0; if (::aug_get(_augeas, "/augeas/files/etc/zypp/zypper.conf/error/message", value)) - error = value[0]; - + error = std::string("/etc/zypp/zypper.conf: ") + value[0]; } // user conf errors if (!_user_conf_path.empty()) { - _got_user_zypper_conf = - ::aug_get(_augeas, _user_conf_path.c_str(), NULL) != 0; + _got_user_zypper_conf = ::aug_get(_augeas, _user_conf_path.c_str(), NULL) != 0; string user_conf_err = "/augeas" + _user_conf_path + "/error/message"; if (::aug_get(_augeas, user_conf_err.c_str(), value)) - error += string("\n") + value[0]; + { + if ( ! error.empty() ) error += string("\n"); + error += _user_conf_path.substr( 6 ); + error += ": "; + error += value[0]; + } } if (!_got_global_zypper_conf && !_got_user_zypper_conf) -- 2.7.4