mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-30 00:54:30 +02:00
parent
37179cdf32
commit
b5792a0b81
@ -219,6 +219,17 @@ ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name)
|
|||||||
return ConfigItem::Ptr();
|
return ConfigItem::Ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ConfigItem::HasObject(const String& type, const String& name)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
|
ConfigItem::ItemMap::iterator it;
|
||||||
|
|
||||||
|
it = m_Items.find(std::make_pair(type, name));
|
||||||
|
|
||||||
|
return (it != m_Items.end());
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigItem::ValidateItem(void)
|
void ConfigItem::ValidateItem(void)
|
||||||
{
|
{
|
||||||
if (m_Validated)
|
if (m_Validated)
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
|
|
||||||
static ConfigItem::Ptr GetObject(const String& type,
|
static ConfigItem::Ptr GetObject(const String& type,
|
||||||
const String& name);
|
const String& name);
|
||||||
|
static bool HasObject(const String& type, const String& name);
|
||||||
|
|
||||||
void ValidateItem(void);
|
void ValidateItem(void);
|
||||||
|
|
||||||
|
@ -45,8 +45,6 @@ bool TypeRule::MatchName(const String& name) const
|
|||||||
|
|
||||||
bool TypeRule::MatchValue(const Value& value, String *hint) const
|
bool TypeRule::MatchValue(const Value& value, String *hint) const
|
||||||
{
|
{
|
||||||
ConfigItem::Ptr item;
|
|
||||||
|
|
||||||
if (value.IsEmpty())
|
if (value.IsEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -78,9 +76,7 @@ bool TypeRule::MatchValue(const Value& value, String *hint) const
|
|||||||
if (!value.IsScalar())
|
if (!value.IsScalar())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
item = ConfigItem::GetObject(m_NameType, value);
|
if (!ConfigItem::HasObject(m_NameType, value)) {
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
*hint = "Object '" + value + "' of type '" + m_NameType + "' does not exist.";
|
*hint = "Object '" + value + "' of type '" + m_NameType + "' does not exist.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user