mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 05:34:48 +02:00
Fix wrong type logging in ConfigItem::Commit
This commit is contained in:
parent
407a2d052b
commit
495b6906f7
@ -174,15 +174,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
||||||
{
|
{
|
||||||
|
Type::Ptr type = GetType();
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
Log(LogDebug, "ConfigItem")
|
Log(LogDebug, "ConfigItem")
|
||||||
<< "Commit called for ConfigItem Type=" << GetType() << ", Name=" << GetName();
|
<< "Commit called for ConfigItem Type=" << type->GetName() << ", Name=" << GetName();
|
||||||
#endif /* I2_DEBUG */
|
#endif /* I2_DEBUG */
|
||||||
|
|
||||||
/* Make sure the type is valid. */
|
/* Make sure the type is valid. */
|
||||||
Type::Ptr type = GetType();
|
|
||||||
if (!type || !ConfigObject::TypeInstance->IsAssignableFrom(type))
|
if (!type || !ConfigObject::TypeInstance->IsAssignableFrom(type))
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Type '" + GetType() + "' does not exist.", m_DebugInfo));
|
BOOST_THROW_EXCEPTION(ScriptError("Type '" + type->GetName() + "' does not exist.", m_DebugInfo));
|
||||||
|
|
||||||
if (IsAbstract())
|
if (IsAbstract())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -204,7 +205,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
if (m_IgnoreOnError) {
|
if (m_IgnoreOnError) {
|
||||||
Log(LogNotice, "ConfigObject")
|
Log(LogNotice, "ConfigObject")
|
||||||
<< "Ignoring config object '" << m_Name << "' of type '" << m_Type->GetName() << "' due to errors: " << DiagnosticInformation(ex);
|
<< "Ignoring config object '" << m_Name << "' of type '" << type->GetName() << "' due to errors: " << DiagnosticInformation(ex);
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
@ -256,7 +257,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||||||
} catch (ValidationError& ex) {
|
} catch (ValidationError& ex) {
|
||||||
if (m_IgnoreOnError) {
|
if (m_IgnoreOnError) {
|
||||||
Log(LogNotice, "ConfigObject")
|
Log(LogNotice, "ConfigObject")
|
||||||
<< "Ignoring config object '" << m_Name << "' of type '" << m_Type->GetName() << "' due to errors: " << DiagnosticInformation(ex);
|
<< "Ignoring config object '" << m_Name << "' of type '" << type->GetName() << "' due to errors: " << DiagnosticInformation(ex);
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
@ -289,7 +290,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr persistentItem = new Dictionary({
|
Dictionary::Ptr persistentItem = new Dictionary({
|
||||||
{ "type", GetType()->GetName() },
|
{ "type", type->GetName() },
|
||||||
{ "name", GetName() },
|
{ "name", GetName() },
|
||||||
{ "properties", Serialize(dobj, FAConfig) },
|
{ "properties", Serialize(dobj, FAConfig) },
|
||||||
{ "debug_hints", dhint },
|
{ "debug_hints", dhint },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user