mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-22 21:24:41 +02:00
Use nullptr instead of <Type>::Ptr()
This commit is contained in:
parent
3c60fbf75d
commit
325e4a2fb9
@ -706,7 +706,7 @@ ConfigObject::Ptr ConfigObject::GetObject(const String& type, const String& name
|
|||||||
ConfigType *ctype = dynamic_cast<ConfigType *>(ptype.get());
|
ConfigType *ctype = dynamic_cast<ConfigType *>(ptype.get());
|
||||||
|
|
||||||
if (!ctype)
|
if (!ctype)
|
||||||
return ConfigObject::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return ctype->GetObject(name);
|
return ctype->GetObject(name);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ ConfigObject::Ptr ConfigType::GetObject(const String& name) const
|
|||||||
auto nt = m_ObjectMap.find(name);
|
auto nt = m_ObjectMap.find(name);
|
||||||
|
|
||||||
if (nt == m_ObjectMap.end())
|
if (nt == m_ObjectMap.end())
|
||||||
return ConfigObject::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return nt->second;
|
return nt->second;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
static void EmitArray(std::ostream& fp, int indentLevel, const Array::Ptr& val);
|
static void EmitArray(std::ostream& fp, int indentLevel, const Array::Ptr& val);
|
||||||
static void EmitArrayItems(std::ostream& fp, int indentLevel, const Array::Ptr& val);
|
static void EmitArrayItems(std::ostream& fp, int indentLevel, const Array::Ptr& val);
|
||||||
static void EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val,
|
static void EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val,
|
||||||
const Array::Ptr& imports = Array::Ptr(), bool splitDot = false);
|
const Array::Ptr& imports = nullptr, bool splitDot = false);
|
||||||
static void EmitValue(std::ostream& fp, int indentLevel, const Value& val);
|
static void EmitValue(std::ostream& fp, int indentLevel, const Value& val);
|
||||||
static void EmitRaw(std::ostream& fp, const String& val);
|
static void EmitRaw(std::ostream& fp, const String& val);
|
||||||
static void EmitIndent(std::ostream& fp, int indentLevel);
|
static void EmitIndent(std::ostream& fp, int indentLevel);
|
||||||
|
@ -39,7 +39,7 @@ String ObjectType::GetName(void) const
|
|||||||
|
|
||||||
Type::Ptr ObjectType::GetBaseType(void) const
|
Type::Ptr ObjectType::GetBaseType(void) const
|
||||||
{
|
{
|
||||||
return Type::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObjectType::GetAttributes(void) const
|
int ObjectType::GetAttributes(void) const
|
||||||
|
@ -34,7 +34,7 @@ String PrimitiveType::GetName(void) const
|
|||||||
Type::Ptr PrimitiveType::GetBaseType(void) const
|
Type::Ptr PrimitiveType::GetBaseType(void) const
|
||||||
{
|
{
|
||||||
if (m_Base == "None")
|
if (m_Base == "None")
|
||||||
return Type::Ptr();
|
return nullptr;
|
||||||
else
|
else
|
||||||
return Type::GetByName(m_Base);
|
return Type::GetByName(m_Base);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
static const std::deque<Process::Ptr>::size_type MaxTasksPerThread = 512;
|
static const std::deque<Process::Ptr>::size_type MaxTasksPerThread = 512;
|
||||||
|
|
||||||
Process(const Arguments& arguments, const Dictionary::Ptr& extraEnvironment = Dictionary::Ptr());
|
Process(const Arguments& arguments, const Dictionary::Ptr& extraEnvironment = nullptr);
|
||||||
~Process(void);
|
~Process(void);
|
||||||
|
|
||||||
void SetTimeout(double timeout);
|
void SetTimeout(double timeout);
|
||||||
|
@ -405,7 +405,7 @@ ConfigObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name)
|
|||||||
ConfigType *ctype = dynamic_cast<ConfigType *>(ptype.get());
|
ConfigType *ctype = dynamic_cast<ConfigType *>(ptype.get());
|
||||||
|
|
||||||
if (!ctype)
|
if (!ctype)
|
||||||
return ConfigObject::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return ctype->GetObject(name);
|
return ctype->GetObject(name);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ static Object::Ptr SerializeObject(const Object::Ptr& input, int attributeTypes)
|
|||||||
Type::Ptr type = input->GetReflectionType();
|
Type::Ptr type = input->GetReflectionType();
|
||||||
|
|
||||||
if (!type)
|
if (!type)
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Dictionary::Ptr fields = new Dictionary();
|
Dictionary::Ptr fields = new Dictionary();
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ Value icinga::Serialize(const Value& value, int attributeTypes)
|
|||||||
|
|
||||||
Value icinga::Deserialize(const Value& value, bool safe_mode, int attributeTypes)
|
Value icinga::Deserialize(const Value& value, bool safe_mode, int attributeTypes)
|
||||||
{
|
{
|
||||||
return Deserialize(Object::Ptr(), value, safe_mode, attributeTypes);
|
return Deserialize(nullptr, value, safe_mode, attributeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value icinga::Deserialize(const Object::Ptr& object, const Value& value, bool safe_mode, int attributeTypes)
|
Value icinga::Deserialize(const Object::Ptr& object, const Value& value, bool safe_mode, int attributeTypes)
|
||||||
|
@ -49,12 +49,12 @@ Type::Ptr Type::GetByName(const String& name)
|
|||||||
Dictionary::Ptr typesNS = ScriptGlobal::Get("Types", &Empty);
|
Dictionary::Ptr typesNS = ScriptGlobal::Get("Types", &Empty);
|
||||||
|
|
||||||
if (!typesNS)
|
if (!typesNS)
|
||||||
return Type::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Value ptype = typesNS->Get(name);
|
Value ptype = typesNS->Get(name);
|
||||||
|
|
||||||
if (!ptype.IsObjectType<Type>())
|
if (!ptype.IsObjectType<Type>())
|
||||||
return Type::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return ptype;
|
return ptype;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ Type::Ptr Value::GetReflectionType(void) const
|
|||||||
case ValueObject:
|
case ValueObject:
|
||||||
return boost::get<Object::Ptr>(m_Value)->GetReflectionType();
|
return boost::get<Object::Ptr>(m_Value)->GetReflectionType();
|
||||||
default:
|
default:
|
||||||
return Type::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,9 @@ public:
|
|||||||
inline Value(void)
|
inline Value(void)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
inline Value(std::nullptr_t)
|
||||||
|
{ }
|
||||||
|
|
||||||
inline Value(int value)
|
inline Value(int value)
|
||||||
: m_Value(double(value))
|
: m_Value(double(value))
|
||||||
{ }
|
{ }
|
||||||
|
@ -130,7 +130,7 @@ CLICommand::Ptr CLICommand::GetByName(const std::vector<String>& name)
|
|||||||
auto it = GetRegistry().find(name);
|
auto it = GetRegistry().find(name);
|
||||||
|
|
||||||
if (it == GetRegistry().end())
|
if (it == GetRegistry().end())
|
||||||
return CLICommand::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ private:
|
|||||||
class I2_CONFIG_API ActivationScope
|
class I2_CONFIG_API ActivationScope
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ActivationScope(const ActivationContext::Ptr& context = ActivationContext::Ptr());
|
ActivationScope(const ActivationContext::Ptr& context = nullptr);
|
||||||
~ActivationScope(void);
|
~ActivationScope(void);
|
||||||
|
|
||||||
ActivationContext::Ptr GetContext(void) const;
|
ActivationContext::Ptr GetContext(void) const;
|
||||||
|
@ -185,7 +185,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||||||
BOOST_THROW_EXCEPTION(ScriptError("Type '" + GetType() + "' does not exist.", m_DebugInfo));
|
BOOST_THROW_EXCEPTION(ScriptError("Type '" + GetType() + "' does not exist.", m_DebugInfo));
|
||||||
|
|
||||||
if (IsAbstract())
|
if (IsAbstract())
|
||||||
return ConfigObject::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
ConfigObject::Ptr dobj = static_pointer_cast<ConfigObject>(type->Instantiate(std::vector<Value>()));
|
ConfigObject::Ptr dobj = static_pointer_cast<ConfigObject>(type->Instantiate(std::vector<Value>()));
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||||||
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConfigObject::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
@ -263,7 +263,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||||||
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConfigObject::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ex.SetDebugHint(dhint);
|
ex.SetDebugHint(dhint);
|
||||||
@ -282,7 +282,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
|
|||||||
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
m_IgnoredItems.push_back(m_DebugInfo.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConfigObject::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
@ -378,12 +378,12 @@ ConfigItem::Ptr ConfigItem::GetByTypeAndName(const Type::Ptr& type, const String
|
|||||||
auto it = m_Items.find(type);
|
auto it = m_Items.find(type);
|
||||||
|
|
||||||
if (it == m_Items.end())
|
if (it == m_Items.end())
|
||||||
return ConfigItem::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
auto it2 = it->second.find(name);
|
auto it2 = it->second.find(name);
|
||||||
|
|
||||||
if (it2 == it->second.end())
|
if (it2 == it->second.end())
|
||||||
return ConfigItem::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return it2->second;
|
return it2->second;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace icinga
|
|||||||
struct DebugHint
|
struct DebugHint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DebugHint(const Dictionary::Ptr& hints = Dictionary::Ptr())
|
DebugHint(const Dictionary::Ptr& hints = nullptr)
|
||||||
: m_Hints(hints)
|
: m_Hints(hints)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ public:
|
|||||||
NameComposer *nc = dynamic_cast<NameComposer *>(type.get());
|
NameComposer *nc = dynamic_cast<NameComposer *>(type.get());
|
||||||
|
|
||||||
if (nc)
|
if (nc)
|
||||||
checkName = nc->MakeName(name, Dictionary::Ptr());
|
checkName = nc->MakeName(name, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkName.IsEmpty()) {
|
if (!checkName.IsEmpty()) {
|
||||||
|
@ -45,5 +45,5 @@ Dictionary::Ptr CommandDbObject::GetConfigFields(void) const
|
|||||||
|
|
||||||
Dictionary::Ptr CommandDbObject::GetStatusFields(void) const
|
Dictionary::Ptr CommandDbObject::GetStatusFields(void) const
|
||||||
{
|
{
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ DbObject::Ptr DbObject::GetOrCreateByObject(const ConfigObject::Ptr& object)
|
|||||||
DbType::Ptr dbtype = DbType::GetByName(object->GetReflectionType()->GetName());
|
DbType::Ptr dbtype = DbType::GetByName(object->GetReflectionType()->GetName());
|
||||||
|
|
||||||
if (!dbtype)
|
if (!dbtype)
|
||||||
return DbObject::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
String name1, name2;
|
String name1, name2;
|
||||||
|
@ -68,7 +68,7 @@ DbType::Ptr DbType::GetByName(const String& name)
|
|||||||
auto it = GetTypes().find(typeName);
|
auto it = GetTypes().find(typeName);
|
||||||
|
|
||||||
if (it == GetTypes().end())
|
if (it == GetTypes().end())
|
||||||
return DbType::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ DbType::Ptr DbType::GetByID(long tid)
|
|||||||
return kv.second;
|
return kv.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DbType::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DbObject::Ptr DbType::GetOrCreateObjectByName(const String& name1, const String& name2)
|
DbObject::Ptr DbType::GetOrCreateObjectByName(const String& name1, const String& name2)
|
||||||
|
@ -47,5 +47,5 @@ Dictionary::Ptr HostGroupDbObject::GetConfigFields(void) const
|
|||||||
|
|
||||||
Dictionary::Ptr HostGroupDbObject::GetStatusFields(void) const
|
Dictionary::Ptr HostGroupDbObject::GetStatusFields(void) const
|
||||||
{
|
{
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -46,5 +46,5 @@ Dictionary::Ptr ServiceGroupDbObject::GetConfigFields(void) const
|
|||||||
|
|
||||||
Dictionary::Ptr ServiceGroupDbObject::GetStatusFields(void) const
|
Dictionary::Ptr ServiceGroupDbObject::GetStatusFields(void) const
|
||||||
{
|
{
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -44,5 +44,5 @@ Dictionary::Ptr UserGroupDbObject::GetConfigFields(void) const
|
|||||||
|
|
||||||
Dictionary::Ptr UserGroupDbObject::GetStatusFields(void) const
|
Dictionary::Ptr UserGroupDbObject::GetStatusFields(void) const
|
||||||
{
|
{
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -684,12 +684,12 @@ Dictionary::Ptr IdoMysqlConnection::FetchRow(const IdoMysqlResult& result)
|
|||||||
row = mysql_fetch_row(result.get());
|
row = mysql_fetch_row(result.get());
|
||||||
|
|
||||||
if (!row)
|
if (!row)
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
lengths = mysql_fetch_lengths(result.get());
|
lengths = mysql_fetch_lengths(result.get());
|
||||||
|
|
||||||
if (!lengths)
|
if (!lengths)
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Dictionary::Ptr dict = new Dictionary();
|
Dictionary::Ptr dict = new Dictionary();
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ Dictionary::Ptr IdoPgsqlConnection::FetchRow(const IdoPgsqlResult& result, int r
|
|||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
if (row >= PQntuples(result.get()))
|
if (row >= PQntuples(result.get()))
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
int columns = PQnfields(result.get());
|
int columns = PQnfields(result.get());
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void Demo::DemoTimerHandler(void)
|
|||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
if (listener) {
|
if (listener) {
|
||||||
MessageOrigin::Ptr origin = new MessageOrigin();
|
MessageOrigin::Ptr origin = new MessageOrigin();
|
||||||
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
|
listener->RelayMessage(origin, nullptr, message, true);
|
||||||
Log(LogInformation, "Demo", "Sent demo::HelloWorld message");
|
Log(LogInformation, "Demo", "Sent demo::HelloWorld message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ Dictionary::Ptr ApiActions::SendCustomNotification(const ConfigObject::Ptr& obje
|
|||||||
checkable->SetForceNextNotification(true);
|
checkable->SetForceNextNotification(true);
|
||||||
|
|
||||||
Checkable::OnNotificationsRequested(checkable, NotificationCustom, checkable->GetLastCheckResult(),
|
Checkable::OnNotificationsRequested(checkable, NotificationCustom, checkable->GetLastCheckResult(),
|
||||||
HttpUtility::GetLastParameter(params, "author"), HttpUtility::GetLastParameter(params, "comment"), MessageOrigin::Ptr());
|
HttpUtility::GetLastParameter(params, "author"), HttpUtility::GetLastParameter(params, "comment"), nullptr);
|
||||||
|
|
||||||
return ApiActions::CreateResult(200, "Successfully sent custom notification for object '" + checkable->GetName() + "'.");
|
return ApiActions::CreateResult(200, "Successfully sent custom notification for object '" + checkable->GetName() + "'.");
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
static Dictionary::Ptr GenerateTicket(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);
|
static Dictionary::Ptr GenerateTicket(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Dictionary::Ptr CreateResult(int code, const String& status, const Dictionary::Ptr& additional = Dictionary::Ptr());
|
static Dictionary::Ptr CreateResult(int code, const String& status, const Dictionary::Ptr& additional = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||||||
if (!in_downtime && !was_flapping && is_flapping) {
|
if (!in_downtime && !was_flapping && is_flapping) {
|
||||||
/* FlappingStart notifications happen on state changes, not in downtimes */
|
/* FlappingStart notifications happen on state changes, not in downtimes */
|
||||||
if (!IsPaused())
|
if (!IsPaused())
|
||||||
OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "", MessageOrigin::Ptr());
|
OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "", nullptr);
|
||||||
|
|
||||||
Log(LogNotice, "Checkable")
|
Log(LogNotice, "Checkable")
|
||||||
<< "Flapping Start: Checkable '" << GetName() << "' started flapping (Current flapping value "
|
<< "Flapping Start: Checkable '" << GetName() << "' started flapping (Current flapping value "
|
||||||
@ -381,7 +381,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||||||
} else if (!in_downtime && was_flapping && !is_flapping) {
|
} else if (!in_downtime && was_flapping && !is_flapping) {
|
||||||
/* FlappingEnd notifications are independent from state changes, must not happen in downtine */
|
/* FlappingEnd notifications are independent from state changes, must not happen in downtine */
|
||||||
if (!IsPaused())
|
if (!IsPaused())
|
||||||
OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "", MessageOrigin::Ptr());
|
OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "", nullptr);
|
||||||
|
|
||||||
Log(LogNotice, "Checkable")
|
Log(LogNotice, "Checkable")
|
||||||
<< "Flapping Stop: Checkable '" << GetName() << "' stopped flapping (Current flapping value "
|
<< "Flapping Stop: Checkable '" << GetName() << "' stopped flapping (Current flapping value "
|
||||||
@ -392,7 +392,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||||||
|
|
||||||
if (send_notification && !is_flapping) {
|
if (send_notification && !is_flapping) {
|
||||||
if (!IsPaused())
|
if (!IsPaused())
|
||||||
OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", MessageOrigin::Ptr());
|
OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
|
|||||||
|
|
||||||
if (host && host->GetState() != HostUp && host->GetStateType() == StateTypeHard) {
|
if (host && host->GetState() != HostUp && host->GetStateType() == StateTypeHard) {
|
||||||
if (failedDependency)
|
if (failedDependency)
|
||||||
*failedDependency = Dependency::Ptr();
|
*failedDependency = nullptr;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (failedDependency)
|
if (failedDependency)
|
||||||
*failedDependency = Dependency::Ptr();
|
*failedDependency = nullptr;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ void Checkable::AcknowledgeProblem(const String& author, const String& comment,
|
|||||||
SetAcknowledgementExpiry(expiry);
|
SetAcknowledgementExpiry(expiry);
|
||||||
|
|
||||||
if (notify && !IsPaused())
|
if (notify && !IsPaused())
|
||||||
OnNotificationsRequested(this, NotificationAcknowledgement, GetLastCheckResult(), author, comment, MessageOrigin::Ptr());
|
OnNotificationsRequested(this, NotificationAcknowledgement, GetLastCheckResult(), author, comment, nullptr);
|
||||||
|
|
||||||
OnAcknowledgementSet(this, author, comment, type, notify, persistent, expiry, origin);
|
OnAcknowledgementSet(this, author, comment, type, notify, persistent, expiry, origin);
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ void Checkable::NotifyDowntimeInternal(const Downtime::Ptr& downtime)
|
|||||||
Checkable::Ptr checkable = downtime->GetCheckable();
|
Checkable::Ptr checkable = downtime->GetCheckable();
|
||||||
|
|
||||||
if (!checkable->IsPaused())
|
if (!checkable->IsPaused())
|
||||||
OnNotificationsRequested(checkable, NotificationDowntimeStart, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), MessageOrigin::Ptr());
|
OnNotificationsRequested(checkable, NotificationDowntimeStart, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime)
|
void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime)
|
||||||
@ -185,7 +185,7 @@ void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime)
|
|||||||
Checkable::Ptr checkable = downtime->GetCheckable();
|
Checkable::Ptr checkable = downtime->GetCheckable();
|
||||||
|
|
||||||
if (!checkable->IsPaused())
|
if (!checkable->IsPaused())
|
||||||
OnNotificationsRequested(checkable, NotificationDowntimeEnd, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), MessageOrigin::Ptr());
|
OnNotificationsRequested(checkable, NotificationDowntimeEnd, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkable::ValidateCheckInterval(double value, const ValidationUtils& utils)
|
void Checkable::ValidateCheckInterval(double value, const ValidationUtils& utils)
|
||||||
|
@ -98,8 +98,8 @@ public:
|
|||||||
|
|
||||||
AcknowledgementType GetAcknowledgement(void);
|
AcknowledgementType GetAcknowledgement(void);
|
||||||
|
|
||||||
void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify = true, bool persistent = false, double expiry = 0, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify = true, bool persistent = false, double expiry = 0, const MessageOrigin::Ptr& origin = nullptr);
|
||||||
void ClearAcknowledgement(const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
void ClearAcknowledgement(const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
virtual int GetSeverity(void) const override;
|
virtual int GetSeverity(void) const override;
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
long GetSchedulingOffset(void);
|
long GetSchedulingOffset(void);
|
||||||
void SetSchedulingOffset(long offset);
|
void SetSchedulingOffset(long offset);
|
||||||
|
|
||||||
void UpdateNextCheck(const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
void UpdateNextCheck(const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
bool HasBeenChecked(void) const;
|
bool HasBeenChecked(void) const;
|
||||||
virtual bool IsStateOK(ServiceState state) = 0;
|
virtual bool IsStateOK(ServiceState state) = 0;
|
||||||
@ -121,9 +121,9 @@ public:
|
|||||||
|
|
||||||
static void UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type);
|
static void UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type);
|
||||||
|
|
||||||
void ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr());
|
void ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros = nullptr);
|
||||||
void ExecuteCheck();
|
void ExecuteCheck();
|
||||||
void ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
void ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
Endpoint::Ptr GetCommandEndpoint(void) const;
|
Endpoint::Ptr GetCommandEndpoint(void) const;
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ public:
|
|||||||
void ResetNotificationNumbers(void);
|
void ResetNotificationNumbers(void);
|
||||||
|
|
||||||
/* Event Handler */
|
/* Event Handler */
|
||||||
void ExecuteEventHandler(const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(),
|
void ExecuteEventHandler(const Dictionary::Ptr& resolvedMacros = nullptr,
|
||||||
bool useResolvedMacros = false);
|
bool useResolvedMacros = false);
|
||||||
|
|
||||||
intrusive_ptr<EventCommand> GetEventCommand(void) const;
|
intrusive_ptr<EventCommand> GetEventCommand(void) const;
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
DECLARE_OBJECTNAME(CheckCommand);
|
DECLARE_OBJECTNAME(CheckCommand);
|
||||||
|
|
||||||
virtual void Execute(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
virtual void Execute(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(),
|
const Dictionary::Ptr& resolvedMacros = nullptr,
|
||||||
bool useResolvedMacros = false);
|
bool useResolvedMacros = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ void ClusterEvents::SendNotificationsHandler(const Checkable::Ptr& checkable, No
|
|||||||
params->Set("author", author);
|
params->Set("author", author);
|
||||||
params->Set("text", text);
|
params->Set("text", text);
|
||||||
|
|
||||||
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
|
listener->RelayMessage(origin, nullptr, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ClusterEvents::SendNotificationsAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
|
Value ClusterEvents::SendNotificationsAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
|
||||||
@ -798,7 +798,7 @@ void ClusterEvents::NotificationSentUserHandler(const Notification::Ptr& notific
|
|||||||
message->Set("method", "event::NotificationSentUser");
|
message->Set("method", "event::NotificationSentUser");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
|
listener->RelayMessage(origin, nullptr, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ClusterEvents::NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
|
Value ClusterEvents::NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
|
||||||
@ -914,7 +914,7 @@ void ClusterEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& n
|
|||||||
message->Set("method", "event::NotificationSentToAllUsers");
|
message->Set("method", "event::NotificationSentToAllUsers");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
listener->RelayMessage(origin, ConfigObject::Ptr(), message, true);
|
listener->RelayMessage(origin, nullptr, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ClusterEvents::NotificationSentToAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
|
Value ClusterEvents::NotificationSentToAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
|
||||||
|
@ -181,7 +181,7 @@ String Comment::AddComment(const Checkable::Ptr& checkable, CommentType entryTyp
|
|||||||
if (!zone.IsEmpty())
|
if (!zone.IsEmpty())
|
||||||
attrs->Set("zone", zone);
|
attrs->Set("zone", zone);
|
||||||
|
|
||||||
String config = ConfigObjectUtility::CreateObjectConfig(Comment::TypeInstance, fullName, true, Array::Ptr(), attrs);
|
String config = ConfigObjectUtility::CreateObjectConfig(Comment::TypeInstance, fullName, true, nullptr, attrs);
|
||||||
|
|
||||||
Array::Ptr errors = new Array();
|
Array::Ptr errors = new Array();
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ public:
|
|||||||
|
|
||||||
static String AddComment(const intrusive_ptr<Checkable>& checkable, CommentType entryType,
|
static String AddComment(const intrusive_ptr<Checkable>& checkable, CommentType entryType,
|
||||||
const String& author, const String& text, bool persistent, double expireTime,
|
const String& author, const String& text, bool persistent, double expireTime,
|
||||||
const String& id = String(), const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
const String& id = String(), const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
static void RemoveComment(const String& id, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
static void RemoveComment(const String& id, const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
static String GetCommentIDFromLegacyID(int id);
|
static String GetCommentIDFromLegacyID(int id);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class Comment : ConfigObject < CommentNameComposer
|
|||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetServiceName().IsEmpty())
|
if (GetServiceName().IsEmpty())
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetHostName());
|
Host::Ptr host = Host::GetByName(GetHostName());
|
||||||
return host->GetServiceByShortName(GetServiceName());
|
return host->GetServiceByShortName(GetServiceName());
|
||||||
|
@ -368,7 +368,7 @@ Dictionary::Ptr CompatUtility::GetCustomAttributeConfig(const CustomVarObject::P
|
|||||||
Dictionary::Ptr vars = object->GetVars();
|
Dictionary::Ptr vars = object->GetVars();
|
||||||
|
|
||||||
if (!vars)
|
if (!vars)
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return vars;
|
return vars;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class Dependency : CustomVarObject < DependencyNameComposer
|
|||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetChildServiceName().IsEmpty())
|
if (GetChildServiceName().IsEmpty())
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetChildHostName());
|
Host::Ptr host = Host::GetByName(GetChildHostName());
|
||||||
return host->GetServiceByShortName(GetChildServiceName());
|
return host->GetServiceByShortName(GetChildServiceName());
|
||||||
@ -87,7 +87,7 @@ class Dependency : CustomVarObject < DependencyNameComposer
|
|||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetParentServiceName().IsEmpty())
|
if (GetParentServiceName().IsEmpty())
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetParentHostName());
|
Host::Ptr host = Host::GetByName(GetParentHostName());
|
||||||
return host->GetServiceByShortName(GetParentServiceName());
|
return host->GetServiceByShortName(GetParentServiceName());
|
||||||
|
@ -255,7 +255,7 @@ String Downtime::AddDowntime(const Checkable::Ptr& checkable, const String& auth
|
|||||||
if (!zone.IsEmpty())
|
if (!zone.IsEmpty())
|
||||||
attrs->Set("zone", zone);
|
attrs->Set("zone", zone);
|
||||||
|
|
||||||
String config = ConfigObjectUtility::CreateObjectConfig(Downtime::TypeInstance, fullName, true, Array::Ptr(), attrs);
|
String config = ConfigObjectUtility::CreateObjectConfig(Downtime::TypeInstance, fullName, true, nullptr, attrs);
|
||||||
|
|
||||||
Array::Ptr errors = new Array();
|
Array::Ptr errors = new Array();
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ public:
|
|||||||
const String& comment, double startTime, double endTime, bool fixed,
|
const String& comment, double startTime, double endTime, bool fixed,
|
||||||
const String& triggeredBy, double duration, const String& scheduledDowntime = String(),
|
const String& triggeredBy, double duration, const String& scheduledDowntime = String(),
|
||||||
const String& scheduledBy = String(), const String& id = String(),
|
const String& scheduledBy = String(), const String& id = String(),
|
||||||
const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
static void RemoveDowntime(const String& id, bool cancelled, bool expired = false, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
static void RemoveDowntime(const String& id, bool cancelled, bool expired = false, const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
void TriggerDowntime(void);
|
void TriggerDowntime(void);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class Downtime : ConfigObject < DowntimeNameComposer
|
|||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetServiceName().IsEmpty())
|
if (GetServiceName().IsEmpty())
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetHostName());
|
Host::Ptr host = Host::GetByName(GetHostName());
|
||||||
return host->GetServiceByShortName(GetServiceName());
|
return host->GetServiceByShortName(GetServiceName());
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
DECLARE_OBJECTNAME(EventCommand);
|
DECLARE_OBJECTNAME(EventCommand);
|
||||||
|
|
||||||
virtual void Execute(const Checkable::Ptr& checkable,
|
virtual void Execute(const Checkable::Ptr& checkable,
|
||||||
const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(),
|
const Dictionary::Ptr& resolvedMacros = nullptr,
|
||||||
bool useResolvedMacros = false);
|
bool useResolvedMacros = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1358,7 +1358,7 @@ void ExternalCommandProcessor::SendCustomHostNotification(double, const std::vec
|
|||||||
}
|
}
|
||||||
|
|
||||||
Checkable::OnNotificationsRequested(host, NotificationCustom,
|
Checkable::OnNotificationsRequested(host, NotificationCustom,
|
||||||
host->GetLastCheckResult(), arguments[2], arguments[3], MessageOrigin::Ptr());
|
host->GetLastCheckResult(), arguments[2], arguments[3], nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::SendCustomSvcNotification(double, const std::vector<String>& arguments)
|
void ExternalCommandProcessor::SendCustomSvcNotification(double, const std::vector<String>& arguments)
|
||||||
@ -1378,7 +1378,7 @@ void ExternalCommandProcessor::SendCustomSvcNotification(double, const std::vect
|
|||||||
}
|
}
|
||||||
|
|
||||||
Service::OnNotificationsRequested(service, NotificationCustom,
|
Service::OnNotificationsRequested(service, NotificationCustom,
|
||||||
service->GetLastCheckResult(), arguments[3], arguments[4], MessageOrigin::Ptr());
|
service->GetLastCheckResult(), arguments[3], arguments[4], nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::DelayHostNotification(double, const std::vector<String>& arguments)
|
void ExternalCommandProcessor::DelayHostNotification(double, const std::vector<String>& arguments)
|
||||||
|
@ -144,7 +144,7 @@ Service::Ptr Host::GetServiceByShortName(const Value& name)
|
|||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
} else if (name.IsObjectType<Dictionary>()) {
|
} else if (name.IsObjectType<Dictionary>()) {
|
||||||
Dictionary::Ptr dict = name;
|
Dictionary::Ptr dict = name;
|
||||||
String short_name;
|
String short_name;
|
||||||
|
@ -451,7 +451,7 @@ Dictionary::Ptr LegacyTimePeriod::FindNextSegment(const String& daydef, const St
|
|||||||
} while (tsiter < tsend);
|
} while (tsiter < tsend);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Array::Ptr LegacyTimePeriod::ScriptFunc(const TimePeriod::Ptr& tp, double begin, double end)
|
Array::Ptr LegacyTimePeriod::ScriptFunc(const TimePeriod::Ptr& tp, double begin, double end)
|
||||||
|
@ -291,7 +291,7 @@ Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverLis
|
|||||||
for (const Value& value : arr) {
|
for (const Value& value : arr) {
|
||||||
if (value.IsScalar()) {
|
if (value.IsScalar()) {
|
||||||
resolved_arr->Add(InternalResolveMacros(value,
|
resolved_arr->Add(InternalResolveMacros(value,
|
||||||
resolvers, cr, missingMacro, EscapeCallback(), Dictionary::Ptr(),
|
resolvers, cr, missingMacro, EscapeCallback(), nullptr,
|
||||||
false, recursionLevel + 1));
|
false, recursionLevel + 1));
|
||||||
} else
|
} else
|
||||||
resolved_arr->Add(value);
|
resolved_arr->Add(value);
|
||||||
@ -300,7 +300,7 @@ Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverLis
|
|||||||
resolved_macro = resolved_arr;
|
resolved_macro = resolved_arr;
|
||||||
} else if (resolved_macro.IsString()) {
|
} else if (resolved_macro.IsString()) {
|
||||||
resolved_macro = InternalResolveMacros(resolved_macro,
|
resolved_macro = InternalResolveMacros(resolved_macro,
|
||||||
resolvers, cr, missingMacro, EscapeCallback(), Dictionary::Ptr(),
|
resolvers, cr, missingMacro, EscapeCallback(), nullptr,
|
||||||
false, recursionLevel + 1);
|
false, recursionLevel + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ public:
|
|||||||
typedef std::vector<ResolverSpec> ResolverList;
|
typedef std::vector<ResolverSpec> ResolverList;
|
||||||
|
|
||||||
static Value ResolveMacros(const Value& str, const ResolverList& resolvers,
|
static Value ResolveMacros(const Value& str, const ResolverList& resolvers,
|
||||||
const CheckResult::Ptr& cr = CheckResult::Ptr(), String *missingMacro = NULL,
|
const CheckResult::Ptr& cr = nullptr, String *missingMacro = NULL,
|
||||||
const EscapeCallback& escapeFn = EscapeCallback(),
|
const EscapeCallback& escapeFn = EscapeCallback(),
|
||||||
const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(),
|
const Dictionary::Ptr& resolvedMacros = nullptr,
|
||||||
bool useResolvedMacros = false, int recursionLevel = 0);
|
bool useResolvedMacros = false, int recursionLevel = 0);
|
||||||
|
|
||||||
static Value ResolveArguments(const Value& command, const Dictionary::Ptr& arguments,
|
static Value ResolveArguments(const Value& command, const Dictionary::Ptr& arguments,
|
||||||
|
@ -431,7 +431,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
|
|||||||
notifiedProblemUsers->Clear();
|
notifiedProblemUsers->Clear();
|
||||||
|
|
||||||
/* used in db_ido for notification history */
|
/* used in db_ido for notification history */
|
||||||
Service::OnNotificationSentToAllUsers(this, checkable, allNotifiedUsers, type, cr, author, text, MessageOrigin::Ptr());
|
Service::OnNotificationSentToAllUsers(this, checkable, allNotifiedUsers, type, cr, author, text, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Notification::CheckNotificationUserFilters(NotificationType type, const User::Ptr& user, bool force, bool reminder)
|
bool Notification::CheckNotificationUserFilters(NotificationType type, const User::Ptr& user, bool force, bool reminder)
|
||||||
@ -518,7 +518,7 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User::
|
|||||||
command->Execute(this, user, cr, type, author, text);
|
command->Execute(this, user, cr, type, author, text);
|
||||||
|
|
||||||
/* required by compatlogger */
|
/* required by compatlogger */
|
||||||
Service::OnNotificationSentToUser(this, GetCheckable(), user, type, cr, author, text, command->GetName(), MessageOrigin::Ptr());
|
Service::OnNotificationSentToUser(this, GetCheckable(), user, type, cr, author, text, command->GetName(), nullptr);
|
||||||
|
|
||||||
Log(LogInformation, "Notification")
|
Log(LogInformation, "Notification")
|
||||||
<< "Completed sending '" << NotificationTypeToStringInternal(type)
|
<< "Completed sending '" << NotificationTypeToStringInternal(type)
|
||||||
|
@ -79,7 +79,7 @@ class Notification : CustomVarObject < NotificationNameComposer
|
|||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetServiceName().IsEmpty())
|
if (GetServiceName().IsEmpty())
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetHostName());
|
Host::Ptr host = Host::GetByName(GetHostName());
|
||||||
return host->GetServiceByShortName(GetServiceName());
|
return host->GetServiceByShortName(GetServiceName());
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
virtual Dictionary::Ptr Execute(const intrusive_ptr<Notification>& notification,
|
virtual Dictionary::Ptr Execute(const intrusive_ptr<Notification>& notification,
|
||||||
const User::Ptr& user, const CheckResult::Ptr& cr, const NotificationType& type,
|
const User::Ptr& user, const CheckResult::Ptr& cr, const NotificationType& type,
|
||||||
const String& author, const String& comment,
|
const String& author, const String& comment,
|
||||||
const Dictionary::Ptr& resolvedMacros = Dictionary::Ptr(),
|
const Dictionary::Ptr& resolvedMacros = nullptr,
|
||||||
bool useResolvedMacros = false);
|
bool useResolvedMacros = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ Service::Ptr ObjectUtils::GetService(const Value& host, const String& name)
|
|||||||
hostObj = Host::GetByName(host);
|
hostObj = Host::GetByName(host);
|
||||||
|
|
||||||
if (!hostObj)
|
if (!hostObj)
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return hostObj->GetServiceByShortName(name);
|
return hostObj->GetServiceByShortName(name);
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ Array::Ptr ObjectUtils::GetServices(const Value& host)
|
|||||||
hostObj = Host::GetByName(host);
|
hostObj = Host::GetByName(host);
|
||||||
|
|
||||||
if (!hostObj)
|
if (!hostObj)
|
||||||
return Array::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return Array::FromVector(hostObj->GetServices());
|
return Array::FromVector(hostObj->GetServices());
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class ScheduledDowntime : CustomVarObject < ScheduledDowntimeNameComposer
|
|||||||
}}}
|
}}}
|
||||||
navigate {{{
|
navigate {{{
|
||||||
if (GetServiceName().IsEmpty())
|
if (GetServiceName().IsEmpty())
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(GetHostName());
|
Host::Ptr host = Host::GetByName(GetHostName());
|
||||||
return host->GetServiceByShortName(GetServiceName());
|
return host->GetServiceByShortName(GetServiceName());
|
||||||
|
@ -111,7 +111,7 @@ Service::Ptr Service::GetByNamePair(const String& hostName, const String& servic
|
|||||||
Host::Ptr host = Host::GetByName(hostName);
|
Host::Ptr host = Host::GetByName(hostName);
|
||||||
|
|
||||||
if (!host)
|
if (!host)
|
||||||
return Service::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return host->GetServiceByShortName(serviceName);
|
return host->GetServiceByShortName(serviceName);
|
||||||
} else {
|
} else {
|
||||||
@ -274,6 +274,6 @@ std::pair<Host::Ptr, Service::Ptr> icinga::GetHostService(const Checkable::Ptr&
|
|||||||
if (service)
|
if (service)
|
||||||
return std::make_pair(service->GetHost(), service);
|
return std::make_pair(service->GetHost(), service);
|
||||||
else
|
else
|
||||||
return std::make_pair(static_pointer_cast<Host>(checkable), Service::Ptr());
|
return std::make_pair(static_pointer_cast<Host>(checkable), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ Object::Ptr HostsTable::HostGroupAccessor(const Value& row, LivestatusGroupByTyp
|
|||||||
if (groupByType == LivestatusGroupByHostGroup)
|
if (groupByType == LivestatusGroupByHostGroup)
|
||||||
return groupByObject;
|
return groupByObject;
|
||||||
|
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::NameAccessor(const Value& row)
|
Value HostsTable::NameAccessor(const Value& row)
|
||||||
@ -328,7 +328,7 @@ Value HostsTable::NotesExpandedAccessor(const Value& row)
|
|||||||
{ "icinga", IcingaApplication::GetInstance() }
|
{ "icinga", IcingaApplication::GetInstance() }
|
||||||
};
|
};
|
||||||
|
|
||||||
return MacroProcessor::ResolveMacros(host->GetNotes(), resolvers, CheckResult::Ptr());
|
return MacroProcessor::ResolveMacros(host->GetNotes(), resolvers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::NotesUrlAccessor(const Value& row)
|
Value HostsTable::NotesUrlAccessor(const Value& row)
|
||||||
|
@ -320,7 +320,7 @@ Filter::Ptr LivestatusQuery::ParseFilter(const String& params, unsigned long& fr
|
|||||||
tokens.push_back("");
|
tokens.push_back("");
|
||||||
|
|
||||||
if (tokens.size() < 3)
|
if (tokens.size() < 3)
|
||||||
return Filter::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
bool negate = false;
|
bool negate = false;
|
||||||
String attr = tokens[0];
|
String attr = tokens[0];
|
||||||
|
@ -117,7 +117,7 @@ Object::Ptr LogTable::HostAccessor(const Value& row, const Column::ObjectAccesso
|
|||||||
String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
|
String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
|
||||||
|
|
||||||
if (host_name.IsEmpty())
|
if (host_name.IsEmpty())
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return Host::GetByName(host_name);
|
return Host::GetByName(host_name);
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ Object::Ptr LogTable::ServiceAccessor(const Value& row, const Column::ObjectAcce
|
|||||||
String service_description = static_cast<Dictionary::Ptr>(row)->Get("service_description");
|
String service_description = static_cast<Dictionary::Ptr>(row)->Get("service_description");
|
||||||
|
|
||||||
if (service_description.IsEmpty() || host_name.IsEmpty())
|
if (service_description.IsEmpty() || host_name.IsEmpty())
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return Service::GetByNamePair(host_name, service_description);
|
return Service::GetByNamePair(host_name, service_description);
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ Object::Ptr LogTable::ContactAccessor(const Value& row, const Column::ObjectAcce
|
|||||||
String contact_name = static_cast<Dictionary::Ptr>(row)->Get("contact_name");
|
String contact_name = static_cast<Dictionary::Ptr>(row)->Get("contact_name");
|
||||||
|
|
||||||
if (contact_name.IsEmpty())
|
if (contact_name.IsEmpty())
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return User::GetByName(contact_name);
|
return User::GetByName(contact_name);
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ Object::Ptr LogTable::CommandAccessor(const Value& row, const Column::ObjectAcce
|
|||||||
String command_name = static_cast<Dictionary::Ptr>(row)->Get("command_name");
|
String command_name = static_cast<Dictionary::Ptr>(row)->Get("command_name");
|
||||||
|
|
||||||
if (command_name.IsEmpty())
|
if (command_name.IsEmpty())
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
CheckCommand::Ptr check_command = CheckCommand::GetByName(command_name);
|
CheckCommand::Ptr check_command = CheckCommand::GetByName(command_name);
|
||||||
if (!check_command) {
|
if (!check_command) {
|
||||||
@ -156,7 +156,7 @@ Object::Ptr LogTable::CommandAccessor(const Value& row, const Column::ObjectAcce
|
|||||||
if (!event_command) {
|
if (!event_command) {
|
||||||
NotificationCommand::Ptr notification_command = NotificationCommand::GetByName(command_name);
|
NotificationCommand::Ptr notification_command = NotificationCommand::GetByName(command_name);
|
||||||
if (!notification_command)
|
if (!notification_command)
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
else
|
else
|
||||||
return notification_command;
|
return notification_command;
|
||||||
} else
|
} else
|
||||||
|
@ -206,7 +206,7 @@ Object::Ptr ServicesTable::HostAccessor(const Value& row, const Column::ObjectAc
|
|||||||
Service::Ptr svc = static_cast<Service::Ptr>(service);
|
Service::Ptr svc = static_cast<Service::Ptr>(service);
|
||||||
|
|
||||||
if (!svc)
|
if (!svc)
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return svc->GetHost();
|
return svc->GetHost();
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ Object::Ptr ServicesTable::ServiceGroupAccessor(const Value& row, LivestatusGrou
|
|||||||
if (groupByType == LivestatusGroupByServiceGroup)
|
if (groupByType == LivestatusGroupByServiceGroup)
|
||||||
return groupByObject;
|
return groupByObject;
|
||||||
|
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::Ptr ServicesTable::HostGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
Object::Ptr ServicesTable::HostGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
||||||
@ -232,7 +232,7 @@ Object::Ptr ServicesTable::HostGroupAccessor(const Value& row, LivestatusGroupBy
|
|||||||
if (groupByType == LivestatusGroupByHostGroup)
|
if (groupByType == LivestatusGroupByHostGroup)
|
||||||
return groupByObject;
|
return groupByObject;
|
||||||
|
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::ShortNameAccessor(const Value& row)
|
Value ServicesTable::ShortNameAccessor(const Value& row)
|
||||||
|
@ -281,7 +281,7 @@ Object::Ptr StateHistTable::HostAccessor(const Value& row, const Column::ObjectA
|
|||||||
String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
|
String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
|
||||||
|
|
||||||
if (host_name.IsEmpty())
|
if (host_name.IsEmpty())
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return Host::GetByName(host_name);
|
return Host::GetByName(host_name);
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ Object::Ptr StateHistTable::ServiceAccessor(const Value& row, const Column::Obje
|
|||||||
String service_description = static_cast<Dictionary::Ptr>(row)->Get("service_description");
|
String service_description = static_cast<Dictionary::Ptr>(row)->Get("service_description");
|
||||||
|
|
||||||
if (service_description.IsEmpty() || host_name.IsEmpty())
|
if (service_description.IsEmpty() || host_name.IsEmpty())
|
||||||
return Object::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return Service::GetByNamePair(host_name, service_description);
|
return Service::GetByNamePair(host_name, service_description);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ Table::Ptr Table::GetByName(const String& name, const String& compat_log_path, c
|
|||||||
else if (name == "zones")
|
else if (name == "zones")
|
||||||
return new ZonesTable();
|
return new ZonesTable();
|
||||||
|
|
||||||
return Table::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Table::AddColumn(const String& name, const Column& column)
|
void Table::AddColumn(const String& name, const Column& column)
|
||||||
|
@ -69,7 +69,7 @@ bool ActionsHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& reques
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FilterUtility::CheckPermission(user, permission);
|
FilterUtility::CheckPermission(user, permission);
|
||||||
objs.push_back(ConfigObject::Ptr());
|
objs.push_back(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Array::Ptr results = new Array();
|
Array::Ptr results = new Array();
|
||||||
|
@ -322,7 +322,7 @@ void ApiClient::AutocompleteScript(const String& session, const String& command,
|
|||||||
req->AddHeader("Accept", "application/json");
|
req->AddHeader("Accept", "application/json");
|
||||||
m_Connection->SubmitRequest(req, std::bind(AutocompleteScriptHttpCompletionCallback, _1, _2, callback));
|
m_Connection->SubmitRequest(req, std::bind(AutocompleteScriptHttpCompletionCallback, _1, _2, callback));
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
callback(boost::current_exception(), Array::Ptr());
|
callback(boost::current_exception(), nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,6 +363,6 @@ void ApiClient::AutocompleteScriptHttpCompletionCallback(HttpRequest& request,
|
|||||||
|
|
||||||
callback(boost::exception_ptr(), suggestions);
|
callback(boost::exception_ptr(), suggestions);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
callback(boost::current_exception(), Array::Ptr());
|
callback(boost::current_exception(), nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ void ApiListener::SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* send the config object to the connected client */
|
/* send the config object to the connected client */
|
||||||
UpdateConfigObject(object, MessageOrigin::Ptr(), aclient);
|
UpdateConfigObject(object, nullptr, aclient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ Endpoint::Ptr ApiListener::GetMaster(void) const
|
|||||||
Zone::Ptr zone = Zone::GetLocalZone();
|
Zone::Ptr zone = Zone::GetLocalZone();
|
||||||
|
|
||||||
if (!zone)
|
if (!zone)
|
||||||
return Endpoint::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
std::vector<String> names;
|
std::vector<String> names;
|
||||||
|
|
||||||
@ -568,10 +568,10 @@ void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoi
|
|||||||
Log(LogInformation, "ApiListener")
|
Log(LogInformation, "ApiListener")
|
||||||
<< "Requesting new certificate for this Icinga instance from endpoint '" << endpoint->GetName() << "'.";
|
<< "Requesting new certificate for this Icinga instance from endpoint '" << endpoint->GetName() << "'.";
|
||||||
|
|
||||||
JsonRpcConnection::SendCertificateRequest(aclient, MessageOrigin::Ptr(), String());
|
JsonRpcConnection::SendCertificateRequest(aclient, nullptr, String());
|
||||||
|
|
||||||
if (Utility::PathExists(ApiListener::GetCertificateRequestsDir()))
|
if (Utility::PathExists(ApiListener::GetCertificateRequestsDir()))
|
||||||
Utility::Glob(ApiListener::GetCertificateRequestsDir() + "/*.json", std::bind(&JsonRpcConnection::SendCertificateRequest, aclient, MessageOrigin::Ptr(), _1), GlobFile);
|
Utility::Glob(ApiListener::GetCertificateRequestsDir() + "/*.json", std::bind(&JsonRpcConnection::SendCertificateRequest, aclient, nullptr, _1), GlobFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that the config updates are synced
|
/* Make sure that the config updates are synced
|
||||||
|
@ -176,9 +176,9 @@ private:
|
|||||||
|
|
||||||
/* configsync */
|
/* configsync */
|
||||||
void UpdateConfigObject(const ConfigObject::Ptr& object, const MessageOrigin::Ptr& origin,
|
void UpdateConfigObject(const ConfigObject::Ptr& object, const MessageOrigin::Ptr& origin,
|
||||||
const JsonRpcConnection::Ptr& client = JsonRpcConnection::Ptr());
|
const JsonRpcConnection::Ptr& client = nullptr);
|
||||||
void DeleteConfigObject(const ConfigObject::Ptr& object, const MessageOrigin::Ptr& origin,
|
void DeleteConfigObject(const ConfigObject::Ptr& object, const MessageOrigin::Ptr& origin,
|
||||||
const JsonRpcConnection::Ptr& client = JsonRpcConnection::Ptr());
|
const JsonRpcConnection::Ptr& client = nullptr);
|
||||||
void SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient);
|
void SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient);
|
||||||
|
|
||||||
void SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoint::Ptr& endpoint, bool needSync);
|
void SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoint::Ptr& endpoint, bool needSync);
|
||||||
|
@ -32,5 +32,5 @@ ApiUser::Ptr ApiUser::GetByClientCN(const String& cn)
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiUser::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
static std::vector<String> GetPackages(void);
|
static std::vector<String> GetPackages(void);
|
||||||
static bool PackageExists(const String& name);
|
static bool PackageExists(const String& name);
|
||||||
|
|
||||||
static String CreateStage(const String& packageName, const Dictionary::Ptr& files = Dictionary::Ptr());
|
static String CreateStage(const String& packageName, const Dictionary::Ptr& files = nullptr);
|
||||||
static void DeleteStage(const String& packageName, const String& stageName);
|
static void DeleteStage(const String& packageName, const String& stageName);
|
||||||
static std::vector<String> GetStages(const String& packageName);
|
static std::vector<String> GetStages(const String& packageName);
|
||||||
static String GetActiveStage(const String& packageName);
|
static String GetActiveStage(const String& packageName);
|
||||||
|
@ -113,7 +113,7 @@ Endpoint::Ptr Endpoint::GetLocalEndpoint(void)
|
|||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
|
|
||||||
if (!listener)
|
if (!listener)
|
||||||
return Endpoint::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return listener->GetLocalEndpoint();
|
return listener->GetLocalEndpoint();
|
||||||
}
|
}
|
||||||
|
@ -115,11 +115,10 @@ Dictionary::Ptr EventQueue::WaitForEvent(void *client, double timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_CV.timed_wait(lock, boost::posix_time::milliseconds(timeout * 1000)))
|
if (!m_CV.timed_wait(lock, boost::posix_time::milliseconds(timeout * 1000)))
|
||||||
return Dictionary::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<EventQueue::Ptr> EventQueue::GetQueuesForType(const String& type)
|
std::vector<EventQueue::Ptr> EventQueue::GetQueuesForType(const String& type)
|
||||||
{
|
{
|
||||||
EventQueueRegistry::ItemMap queues = EventQueueRegistry::GetInstance()->GetItems();
|
EventQueueRegistry::ItemMap queues = EventQueueRegistry::GetInstance()->GetItems();
|
||||||
|
@ -33,7 +33,7 @@ Type::Ptr FilterUtility::TypeFromPluralName(const String& pluralName)
|
|||||||
String uname = pluralName;
|
String uname = pluralName;
|
||||||
boost::algorithm::to_lower(uname);
|
boost::algorithm::to_lower(uname);
|
||||||
|
|
||||||
for (const Type::Ptr&type : Type::GetAllTypes()) {
|
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
||||||
String pname = type->GetPluralName();
|
String pname = type->GetPluralName();
|
||||||
boost::algorithm::to_lower(pname);
|
boost::algorithm::to_lower(pname);
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ Type::Ptr FilterUtility::TypeFromPluralName(const String& pluralName)
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Type::Ptr();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigObjectTargetProvider::FindTargets(const String& type, const std::function<void (const Value&)>& addTarget) const
|
void ConfigObjectTargetProvider::FindTargets(const String& type, const std::function<void (const Value&)>& addTarget) const
|
||||||
|
@ -82,7 +82,7 @@ void HttpServerConnection::Disconnect(void)
|
|||||||
listener->RemoveHttpClient(this);
|
listener->RemoveHttpClient(this);
|
||||||
|
|
||||||
m_CurrentRequest.~HttpRequest();
|
m_CurrentRequest.~HttpRequest();
|
||||||
new (&m_CurrentRequest) HttpRequest(Stream::Ptr());
|
new (&m_CurrentRequest) HttpRequest(nullptr);
|
||||||
|
|
||||||
m_Stream->Close();
|
m_Stream->Close();
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ delayed_request:
|
|||||||
|
|
||||||
Utility::SaveJsonFile(requestPath, 0600, request);
|
Utility::SaveJsonFile(requestPath, 0600, request);
|
||||||
|
|
||||||
JsonRpcConnection::SendCertificateRequest(JsonRpcConnection::Ptr(), origin, requestPath);
|
JsonRpcConnection::SendCertificateRequest(nullptr, origin, requestPath);
|
||||||
|
|
||||||
result->Set("status_code", 2);
|
result->Set("status_code", 2);
|
||||||
result->Set("error", "Certificate request for CN '" + cn + "' is pending. Waiting for approval from the parent Icinga instance.");
|
result->Set("error", "Certificate request for CN '" + cn + "' is pending. Waiting for approval from the parent Icinga instance.");
|
||||||
|
@ -139,7 +139,7 @@ Zone::Ptr Zone::GetLocalZone(void)
|
|||||||
Endpoint::Ptr local = Endpoint::GetLocalEndpoint();
|
Endpoint::Ptr local = Endpoint::GetLocalEndpoint();
|
||||||
|
|
||||||
if (!local)
|
if (!local)
|
||||||
return Zone::Ptr();
|
return nullptr;
|
||||||
|
|
||||||
return local->GetZone();
|
return local->GetZone();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user