mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
Fix compiler warnings by removing unused variables
This commit is contained in:
parent
a13751d972
commit
c1f1ac6e77
@ -557,7 +557,7 @@ static int Main()
|
||||
int rc = 1;
|
||||
|
||||
if (autocomplete) {
|
||||
CLICommand::ShowCommands(argc, argv, &visibleDesc, &hiddenDesc,
|
||||
CLICommand::ShowCommands(argc, argv, &visibleDesc,
|
||||
&GlobalArgumentCompletion, true, autoindex);
|
||||
rc = 0;
|
||||
} else if (command) {
|
||||
|
@ -222,7 +222,7 @@ static Value ProcessSpawnImpl(struct msghdr *msgh, const Dictionary::Ptr& reques
|
||||
return response;
|
||||
}
|
||||
|
||||
static Value ProcessKillImpl(struct msghdr *msgh, const Dictionary::Ptr& request)
|
||||
static Value ProcessKillImpl(const Dictionary::Ptr& request)
|
||||
{
|
||||
pid_t pid = request->Get("pid");
|
||||
int signum = request->Get("signum");
|
||||
@ -238,7 +238,7 @@ static Value ProcessKillImpl(struct msghdr *msgh, const Dictionary::Ptr& request
|
||||
return response;
|
||||
}
|
||||
|
||||
static Value ProcessWaitPIDImpl(struct msghdr *msgh, const Dictionary::Ptr& request)
|
||||
static Value ProcessWaitPIDImpl(const Dictionary::Ptr& request)
|
||||
{
|
||||
pid_t pid = request->Get("pid");
|
||||
|
||||
@ -321,9 +321,9 @@ static void ProcessHandler()
|
||||
if (command == "spawn")
|
||||
response = ProcessSpawnImpl(&msg, request);
|
||||
else if (command == "waitpid")
|
||||
response = ProcessWaitPIDImpl(&msg, request);
|
||||
response = ProcessWaitPIDImpl(request);
|
||||
else if (command == "kill")
|
||||
response = ProcessKillImpl(&msg, request);
|
||||
response = ProcessKillImpl(request);
|
||||
else
|
||||
response = Empty;
|
||||
|
||||
|
@ -220,7 +220,6 @@ found_command:
|
||||
}
|
||||
|
||||
void CLICommand::ShowCommands(int argc, char **argv, po::options_description *visibleDesc,
|
||||
po::options_description *hiddenDesc,
|
||||
ArgumentCompletionCallback globalArgCompletionCallback,
|
||||
bool autocomplete, int autoindex)
|
||||
{
|
||||
|
@ -59,7 +59,6 @@ public:
|
||||
|
||||
static void ShowCommands(int argc, char **argv,
|
||||
boost::program_options::options_description *visibleDesc = nullptr,
|
||||
boost::program_options::options_description *hiddenDesc = nullptr,
|
||||
ArgumentCompletionCallback globalArgCompletionCallback = nullptr,
|
||||
bool autocomplete = false, int autoindex = -1);
|
||||
|
||||
|
@ -768,8 +768,10 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
|
||||
// Whether we already forwarded a termination signal to the seamless worker
|
||||
bool requestedTermination = false;
|
||||
|
||||
#ifdef HAVE_SYSTEMD
|
||||
// Whether we already notified systemd about our termination
|
||||
bool notifiedTermination = false;
|
||||
#endif /* HAVE_SYSTEMD */
|
||||
|
||||
for (;;) {
|
||||
#ifdef HAVE_SYSTEMD
|
||||
|
@ -88,12 +88,12 @@ int NodeSetupCommand::Run(const boost::program_options::variables_map& vm, const
|
||||
}
|
||||
|
||||
if (vm.count("master"))
|
||||
return SetupMaster(vm, ap);
|
||||
return SetupMaster(vm);
|
||||
else
|
||||
return SetupNode(vm, ap);
|
||||
return SetupNode(vm);
|
||||
}
|
||||
|
||||
int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap)
|
||||
int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& vm)
|
||||
{
|
||||
/* Ignore not required parameters */
|
||||
if (vm.count("ticket"))
|
||||
@ -250,7 +250,7 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap)
|
||||
int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm)
|
||||
{
|
||||
/* require at least one endpoint. Ticket is optional. */
|
||||
if (!vm.count("endpoint")) {
|
||||
|
@ -27,8 +27,8 @@ public:
|
||||
int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const override;
|
||||
|
||||
private:
|
||||
static int SetupMaster(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap);
|
||||
static int SetupNode(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap);
|
||||
static int SetupMaster(const boost::program_options::variables_map& vm);
|
||||
static int SetupNode(const boost::program_options::variables_map& vm);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -52,10 +52,10 @@ void CompatLogger::Start(bool runtimeCreated)
|
||||
Checkable::OnNewCheckResult.connect([this](const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MessageOrigin::Ptr&) {
|
||||
CheckResultHandler(checkable, cr);
|
||||
});
|
||||
Checkable::OnNotificationSentToUser.connect([this](const Notification::Ptr& notification, const Checkable::Ptr& checkable,
|
||||
Checkable::OnNotificationSentToUser.connect([this](const Notification::Ptr&, const Checkable::Ptr& checkable,
|
||||
const User::Ptr& user, const NotificationType& type, const CheckResult::Ptr& cr, const String& author,
|
||||
const String& commentText, const String& commandName, const MessageOrigin::Ptr&) {
|
||||
NotificationSentHandler(notification, checkable, user, type, cr, author, commentText, commandName);
|
||||
NotificationSentHandler(checkable, user, type, cr, author, commentText, commandName);
|
||||
});
|
||||
|
||||
Downtime::OnDowntimeTriggered.connect([this](const Downtime::Ptr& downtime) { TriggerDowntimeHandler(downtime); });
|
||||
@ -240,7 +240,7 @@ void CompatLogger::RemoveDowntimeHandler(const Downtime::Ptr& downtime)
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void CompatLogger::NotificationSentHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable,
|
||||
void CompatLogger::NotificationSentHandler(const Checkable::Ptr& checkable,
|
||||
const User::Ptr& user, NotificationType notification_type, CheckResult::Ptr const& cr,
|
||||
const String& author, const String& comment_text, const String& command_name)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ private:
|
||||
void Flush();
|
||||
|
||||
void CheckResultHandler(const Checkable::Ptr& service, const CheckResult::Ptr& cr);
|
||||
void NotificationSentHandler(const Notification::Ptr& notification, const Checkable::Ptr& service,
|
||||
void NotificationSentHandler(const Checkable::Ptr& service,
|
||||
const User::Ptr& user, NotificationType notification_type, CheckResult::Ptr const& cr,
|
||||
const String& author, const String& comment_text, const String& command_name);
|
||||
void FlappingChangedHandler(const Checkable::Ptr& checkable);
|
||||
|
@ -136,7 +136,7 @@ bool VariableExpression::GetReference(ScriptFrame& frame, bool init_dict, Value
|
||||
|
||||
if (dhint && *dhint)
|
||||
*dhint = new DebugHint((*dhint)->GetChild(m_Variable));
|
||||
} else if (VMOps::FindVarImportRef(frame, m_Imports, m_Variable, parent, m_DebugInfo)) {
|
||||
} else if (VMOps::FindVarImportRef(frame, m_Imports, m_Variable, parent)) {
|
||||
return true;
|
||||
} else if (ScriptGlobal::Exists(m_Variable)) {
|
||||
*parent = ScriptGlobal::GetGlobals();
|
||||
@ -470,7 +470,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
|
||||
arguments.push_back(argres.GetValue());
|
||||
}
|
||||
|
||||
return VMOps::ConstructorCall(vfunc, arguments, m_DebugInfo);
|
||||
return VMOps::ConstructorCall(vfunc, arguments);
|
||||
}
|
||||
|
||||
if (!vfunc.IsObjectType<Function>())
|
||||
@ -490,7 +490,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
|
||||
arguments.push_back(argres.GetValue());
|
||||
}
|
||||
|
||||
return VMOps::FunctionCall(frame, self, func, arguments);
|
||||
return VMOps::FunctionCall(self, func, arguments);
|
||||
}
|
||||
|
||||
ExpressionResult ArrayExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
|
||||
|
@ -26,7 +26,7 @@ namespace icinga
|
||||
class VMOps
|
||||
{
|
||||
public:
|
||||
static inline bool FindVarImportRef(ScriptFrame& frame, const std::vector<Expression::Ptr>& imports, const String& name, Value *result, const DebugInfo& debugInfo = DebugInfo())
|
||||
static inline bool FindVarImportRef(ScriptFrame& frame, const std::vector<Expression::Ptr>& imports, const String& name, Value *result)
|
||||
{
|
||||
for (const auto& import : imports) {
|
||||
ExpressionResult res = import->Evaluate(frame);
|
||||
@ -44,7 +44,7 @@ public:
|
||||
{
|
||||
Value parent;
|
||||
|
||||
if (FindVarImportRef(frame, imports, name, &parent, debugInfo)) {
|
||||
if (FindVarImportRef(frame, imports, name, &parent)) {
|
||||
*result = GetField(parent, name, frame.Sandboxed, debugInfo);
|
||||
return true;
|
||||
}
|
||||
@ -52,7 +52,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline Value ConstructorCall(const Type::Ptr& type, const std::vector<Value>& args, const DebugInfo& debugInfo = DebugInfo())
|
||||
static inline Value ConstructorCall(const Type::Ptr& type, const std::vector<Value>& args)
|
||||
{
|
||||
if (type->GetName() == "String") {
|
||||
if (args.empty())
|
||||
@ -81,7 +81,7 @@ public:
|
||||
return type->Instantiate(args);
|
||||
}
|
||||
|
||||
static inline Value FunctionCall(ScriptFrame& frame, const Value& self, const Function::Ptr& func, const std::vector<Value>& arguments)
|
||||
static inline Value FunctionCall(const Value& self, const Function::Ptr& func, const std::vector<Value>& arguments)
|
||||
{
|
||||
if (!self.IsEmpty() || self.IsString())
|
||||
return func->InvokeThis(self, arguments);
|
||||
|
@ -64,9 +64,9 @@ void DbEvents::StaticInitialize()
|
||||
DbEvents::EnableFlappingChangedHandler(checkable);
|
||||
});
|
||||
|
||||
Checkable::OnReachabilityChanged.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||
Checkable::OnReachabilityChanged.connect([](const Checkable::Ptr&, const CheckResult::Ptr& cr,
|
||||
std::set<Checkable::Ptr> children, const MessageOrigin::Ptr&) {
|
||||
DbEvents::ReachabilityChangedHandler(checkable, cr, std::move(children));
|
||||
DbEvents::ReachabilityChangedHandler(cr, std::move(children));
|
||||
});
|
||||
|
||||
/* History */
|
||||
@ -77,23 +77,23 @@ void DbEvents::StaticInitialize()
|
||||
DbEvents::AddAcknowledgementHistory(checkable, author, comment, type, notify, expiry);
|
||||
});
|
||||
|
||||
Checkable::OnNotificationSentToAllUsers.connect([](const Notification::Ptr& notification, const Checkable::Ptr& checkable,
|
||||
const std::set<User::Ptr>& users, const NotificationType& type, const CheckResult::Ptr& cr, const String& author,
|
||||
const String& text, const MessageOrigin::Ptr&) {
|
||||
DbEvents::AddNotificationHistory(notification, checkable, users, type, cr, author, text);
|
||||
Checkable::OnNotificationSentToAllUsers.connect([](const Notification::Ptr&, const Checkable::Ptr& checkable,
|
||||
const std::set<User::Ptr>& users, const NotificationType& type, const CheckResult::Ptr& cr, const String&,
|
||||
const String&, const MessageOrigin::Ptr&) {
|
||||
DbEvents::AddNotificationHistory(checkable, users, type, cr);
|
||||
});
|
||||
|
||||
Checkable::OnStateChange.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type, const MessageOrigin::Ptr&) {
|
||||
DbEvents::AddStateChangeHistory(checkable, cr, type);
|
||||
Checkable::OnStateChange.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType, const MessageOrigin::Ptr&) {
|
||||
DbEvents::AddStateChangeHistory(checkable, cr);
|
||||
});
|
||||
|
||||
Checkable::OnNewCheckResult.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MessageOrigin::Ptr&) {
|
||||
DbEvents::AddCheckResultLogHistory(checkable, cr);
|
||||
});
|
||||
Checkable::OnNotificationSentToUser.connect([](const Notification::Ptr& notification, const Checkable::Ptr& checkable,
|
||||
Checkable::OnNotificationSentToUser.connect([](const Notification::Ptr&, const Checkable::Ptr& checkable,
|
||||
const User::Ptr& users, const NotificationType& type, const CheckResult::Ptr& cr, const String& author, const String& text,
|
||||
const String&, const MessageOrigin::Ptr&) {
|
||||
DbEvents::AddNotificationSentLogHistory(notification, checkable, users, type, cr, author, text);
|
||||
DbEvents::AddNotificationSentLogHistory(checkable, users, type, cr, author, text);
|
||||
});
|
||||
Checkable::OnFlappingChanged.connect([](const Checkable::Ptr& checkable, const Value&) {
|
||||
DbEvents::AddFlappingChangedLogHistory(checkable);
|
||||
@ -219,7 +219,7 @@ void DbEvents::LastNotificationChangedHandler(const Notification::Ptr& notificat
|
||||
DbObject::OnQuery(query1);
|
||||
}
|
||||
|
||||
void DbEvents::ReachabilityChangedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, std::set<Checkable::Ptr> children)
|
||||
void DbEvents::ReachabilityChangedHandler(const CheckResult::Ptr& cr, std::set<Checkable::Ptr> children)
|
||||
{
|
||||
int is_reachable = 0;
|
||||
|
||||
@ -834,8 +834,8 @@ void DbEvents::AddAcknowledgementInternal(const Checkable::Ptr& checkable, Ackno
|
||||
}
|
||||
|
||||
/* notifications */
|
||||
void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users, NotificationType type,
|
||||
const CheckResult::Ptr& cr, const String& author, const String& text)
|
||||
void DbEvents::AddNotificationHistory(const Checkable::Ptr& checkable, const std::set<User::Ptr>& users, NotificationType type,
|
||||
const CheckResult::Ptr& cr)
|
||||
{
|
||||
/* NotificationInsertID has to be tracked per IDO instance, therefore the OnQuery and OnMultipleQueries signals
|
||||
* cannot be called directly as all IDO instances would insert rows with the same ID which is (most likely) only
|
||||
@ -913,7 +913,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
|
||||
}
|
||||
|
||||
/* statehistory */
|
||||
void DbEvents::AddStateChangeHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type)
|
||||
void DbEvents::AddStateChangeHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr)
|
||||
{
|
||||
double ts = cr->GetExecutionEnd();
|
||||
std::pair<unsigned long, unsigned long> timeBag = ConvertTimestamp(ts);
|
||||
@ -1113,7 +1113,7 @@ void DbEvents::AddRemoveDowntimeLogHistory(const Downtime::Ptr& downtime)
|
||||
AddLogHistory(checkable, msgbuf.str(), LogEntryTypeInfoMessage);
|
||||
}
|
||||
|
||||
void DbEvents::AddNotificationSentLogHistory(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const User::Ptr& user,
|
||||
void DbEvents::AddNotificationSentLogHistory(const Checkable::Ptr& checkable, const User::Ptr& user,
|
||||
NotificationType notification_type, const CheckResult::Ptr& cr,
|
||||
const String& author, const String& comment_text)
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
static void RemoveAcknowledgement(const Checkable::Ptr& checkable);
|
||||
static void AddAcknowledgementInternal(const Checkable::Ptr& checkable, AcknowledgementType type, bool add);
|
||||
|
||||
static void ReachabilityChangedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, std::set<Checkable::Ptr> children);
|
||||
static void ReachabilityChangedHandler(const CheckResult::Ptr& cr, std::set<Checkable::Ptr> children);
|
||||
|
||||
/* comment, downtime, acknowledgement history */
|
||||
static void AddCommentHistory(const Comment::Ptr& comment);
|
||||
@ -82,18 +82,17 @@ public:
|
||||
AcknowledgementType type, bool notify, double expiry);
|
||||
|
||||
/* notification & contactnotification history */
|
||||
static void AddNotificationHistory(const Notification::Ptr& notification, const Checkable::Ptr& checkable,
|
||||
const std::set<User::Ptr>& users, NotificationType type, const CheckResult::Ptr& cr, const String& author,
|
||||
const String& text);
|
||||
static void AddNotificationHistory(const Checkable::Ptr& checkable,
|
||||
const std::set<User::Ptr>& users, NotificationType type, const CheckResult::Ptr& cr);
|
||||
|
||||
/* statehistory */
|
||||
static void AddStateChangeHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type);
|
||||
static void AddStateChangeHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
|
||||
|
||||
/* logentries */
|
||||
static void AddCheckResultLogHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr &cr);
|
||||
static void AddTriggerDowntimeLogHistory(const Downtime::Ptr& downtime);
|
||||
static void AddRemoveDowntimeLogHistory(const Downtime::Ptr& downtime);
|
||||
static void AddNotificationSentLogHistory(const Notification::Ptr& notification, const Checkable::Ptr& checkable,
|
||||
static void AddNotificationSentLogHistory(const Checkable::Ptr& checkable,
|
||||
const User::Ptr& user, NotificationType notification_type, const CheckResult::Ptr& cr, const String& author,
|
||||
const String& comment_text);
|
||||
|
||||
|
@ -80,7 +80,7 @@ void Comment::Start(bool runtimeCreated)
|
||||
|
||||
static boost::once_flag once = BOOST_ONCE_INIT;
|
||||
|
||||
boost::call_once(once, [this]() {
|
||||
boost::call_once(once, [] {
|
||||
l_CommentsExpireTimer = Timer::Create();
|
||||
l_CommentsExpireTimer->SetInterval(60);
|
||||
l_CommentsExpireTimer->OnTimerExpired.connect([](const Timer * const&) { CommentsExpireTimerHandler(); });
|
||||
@ -131,7 +131,7 @@ int Comment::GetNextCommentID()
|
||||
}
|
||||
|
||||
Comment::Ptr Comment::AddComment(const Checkable::Ptr& checkable, CommentType entryType, const String& author,
|
||||
const String& text, bool persistent, double expireTime, bool sticky, const String& id, const MessageOrigin::Ptr& origin)
|
||||
const String& text, bool persistent, double expireTime, bool sticky, const String& id)
|
||||
{
|
||||
String fullName;
|
||||
|
||||
@ -187,8 +187,7 @@ Comment::Ptr Comment::AddComment(const Checkable::Ptr& checkable, CommentType en
|
||||
return comment;
|
||||
}
|
||||
|
||||
void Comment::RemoveComment(const String& id, bool removedManually, const String& removedBy,
|
||||
const MessageOrigin::Ptr& origin)
|
||||
void Comment::RemoveComment(const String& id, bool removedManually, const String& removedBy)
|
||||
{
|
||||
Comment::Ptr comment = Comment::GetByName(id);
|
||||
|
||||
|
@ -36,10 +36,9 @@ public:
|
||||
|
||||
static Ptr AddComment(const intrusive_ptr<Checkable>& checkable, CommentType entryType,
|
||||
const String& author, const String& text, bool persistent, double expireTime, bool sticky = false,
|
||||
const String& id = String(), const MessageOrigin::Ptr& origin = nullptr);
|
||||
const String& id = String());
|
||||
|
||||
static void RemoveComment(const String& id, bool removedManually = false, const String& removedBy = "",
|
||||
const MessageOrigin::Ptr& origin = nullptr);
|
||||
static void RemoveComment(const String& id, bool removedManually = false, const String& removedBy = "");
|
||||
|
||||
static String GetCommentIDFromLegacyID(int id);
|
||||
|
||||
|
@ -93,7 +93,7 @@ void Downtime::Start(bool runtimeCreated)
|
||||
|
||||
static boost::once_flag once = BOOST_ONCE_INIT;
|
||||
|
||||
boost::call_once(once, [this]() {
|
||||
boost::call_once(once, [] {
|
||||
l_DowntimesStartTimer = Timer::Create();
|
||||
l_DowntimesStartTimer->SetInterval(5);
|
||||
l_DowntimesStartTimer->OnTimerExpired.connect([](const Timer * const&){ DowntimesStartTimerHandler(); });
|
||||
@ -360,7 +360,7 @@ Downtime::Ptr Downtime::AddDowntime(const Checkable::Ptr& checkable, const Strin
|
||||
}
|
||||
|
||||
void Downtime::RemoveDowntime(const String& id, bool includeChildren, DowntimeRemovalReason removalReason,
|
||||
const String& removedBy, const MessageOrigin::Ptr& origin)
|
||||
const String& removedBy)
|
||||
{
|
||||
Downtime::Ptr downtime = Downtime::GetByName(id);
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
const MessageOrigin::Ptr& origin = nullptr);
|
||||
|
||||
static void RemoveDowntime(const String& id, bool includeChildren, DowntimeRemovalReason removalReason,
|
||||
const String& removedBy = "", const MessageOrigin::Ptr& origin = nullptr);
|
||||
const String& removedBy = "");
|
||||
|
||||
void RegisterChild(const Downtime::Ptr& downtime);
|
||||
void UnregisterChild(const Downtime::Ptr& downtime);
|
||||
|
@ -67,7 +67,7 @@ Value MacroProcessor::ResolveMacros(const Value& str, const ResolverList& resolv
|
||||
|
||||
result = resultDict;
|
||||
} else if (str.IsObjectType<Function>()) {
|
||||
result = EvaluateFunction(str, resolvers, cr, escapeFn, resolvedMacros, useResolvedMacros, 0);
|
||||
result = EvaluateFunction(str, resolvers, cr, resolvedMacros, useResolvedMacros, 0);
|
||||
} else {
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Macro is not a string or array."));
|
||||
}
|
||||
@ -192,7 +192,7 @@ bool MacroProcessor::ResolveMacro(const String& macro, const ResolverList& resol
|
||||
}
|
||||
|
||||
Value MacroProcessor::EvaluateFunction(const Function::Ptr& func, const ResolverList& resolvers,
|
||||
const CheckResult::Ptr& cr, const MacroProcessor::EscapeCallback& escapeFn,
|
||||
const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int recursionLevel)
|
||||
{
|
||||
Dictionary::Ptr resolvers_this = new Dictionary();
|
||||
@ -273,7 +273,7 @@ Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverLis
|
||||
}
|
||||
|
||||
if (resolved_macro.IsObjectType<Function>()) {
|
||||
resolved_macro = EvaluateFunction(resolved_macro, resolvers, cr, escapeFn,
|
||||
resolved_macro = EvaluateFunction(resolved_macro, resolvers, cr,
|
||||
resolvedMacros, useResolvedMacros, recursionLevel + 1);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ private:
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros,
|
||||
int recursionLevel = 0);
|
||||
static Value EvaluateFunction(const Function::Ptr& func, const ResolverList& resolvers,
|
||||
const CheckResult::Ptr& cr, const MacroProcessor::EscapeCallback& escapeFn,
|
||||
const CheckResult::Ptr& cr,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int recursionLevel);
|
||||
|
||||
static void AddArgumentHelper(const Array::Ptr& args, const String& key, const String& value,
|
||||
|
@ -494,8 +494,8 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
|
||||
|
||||
// Explicitly use Notification::Ptr to keep the reference counted while the callback is active
|
||||
Notification::Ptr notification (this);
|
||||
Utility::QueueAsyncCallback([notification, type, user, cr, force, author, text]() {
|
||||
notification->ExecuteNotificationHelper(type, user, cr, force, author, text);
|
||||
Utility::QueueAsyncCallback([notification, type, user, cr, author, text]() {
|
||||
notification->ExecuteNotificationHelper(type, user, cr, author, text);
|
||||
});
|
||||
|
||||
/* collect all notified users */
|
||||
@ -600,7 +600,7 @@ bool Notification::CheckNotificationUserFilters(NotificationType type, const Use
|
||||
return true;
|
||||
}
|
||||
|
||||
void Notification::ExecuteNotificationHelper(NotificationType type, const User::Ptr& user, const CheckResult::Ptr& cr, bool force, const String& author, const String& text)
|
||||
void Notification::ExecuteNotificationHelper(NotificationType type, const User::Ptr& user, const CheckResult::Ptr& cr, const String& author, const String& text)
|
||||
{
|
||||
String notificationName = GetName();
|
||||
String userName = user->GetName();
|
||||
|
@ -142,7 +142,7 @@ private:
|
||||
|
||||
bool CheckNotificationUserFilters(NotificationType type, const User::Ptr& user, bool force, bool reminder);
|
||||
|
||||
void ExecuteNotificationHelper(NotificationType type, const User::Ptr& user, const CheckResult::Ptr& cr, bool force, const String& author = "", const String& text = "");
|
||||
void ExecuteNotificationHelper(NotificationType type, const User::Ptr& user, const CheckResult::Ptr& cr, const String& author = "", const String& text = "");
|
||||
|
||||
static bool EvaluateApplyRuleInstance(const intrusive_ptr<Checkable>& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule, bool skipFilter);
|
||||
static bool EvaluateApplyRule(const intrusive_ptr<Checkable>& checkable, const ApplyRule& rule, bool skipFilter = false);
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkable::Ptr& checkable,
|
||||
void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj,
|
||||
const CheckResult::Ptr& cr, const MacroProcessor::ResolverList& macroResolvers,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int timeout,
|
||||
const std::function<void(const Value& commandLine, const ProcessResult&)>& callback)
|
||||
|
@ -22,7 +22,7 @@ struct ProcessResult;
|
||||
class PluginUtility
|
||||
{
|
||||
public:
|
||||
static void ExecuteCommand(const Command::Ptr& commandObj, const Checkable::Ptr& checkable,
|
||||
static void ExecuteCommand(const Command::Ptr& commandObj,
|
||||
const CheckResult::Ptr& cr, const MacroProcessor::ResolverList& macroResolvers,
|
||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int timeout,
|
||||
const std::function<void(const Value& commandLine, const ProcessResult&)>& callback = std::function<void(const Value& commandLine, const ProcessResult&)>());
|
||||
|
@ -77,7 +77,7 @@ void ScheduledDowntime::Start(bool runtimeCreated)
|
||||
|
||||
static boost::once_flag once = BOOST_ONCE_INIT;
|
||||
|
||||
boost::call_once(once, [this]() {
|
||||
boost::call_once(once, [] {
|
||||
l_Timer = Timer::Create();
|
||||
l_Timer->SetInterval(60);
|
||||
l_Timer->OnTimerExpired.connect([](const Timer * const&) { TimerProc(); });
|
||||
|
@ -23,7 +23,7 @@ void TimePeriod::Start(bool runtimeCreated)
|
||||
|
||||
static boost::once_flag once = BOOST_ONCE_INIT;
|
||||
|
||||
boost::call_once(once, [this]() {
|
||||
boost::call_once(once, [] {
|
||||
l_UpdateTimer = Timer::Create();
|
||||
l_UpdateTimer->SetInterval(300);
|
||||
l_UpdateTimer->OnTimerExpired.connect([](const Timer * const&) { UpdateTimerHandler(); });
|
||||
|
@ -1494,7 +1494,7 @@ void IcingaDB::AddObjectDataToRuntimeUpdates(std::vector<Dictionary::Ptr>& runti
|
||||
|
||||
// Takes object and collects IcingaDB relevant attributes and computes checksums. Returns whether the object is relevant
|
||||
// for IcingaDB.
|
||||
bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& attributes, Dictionary::Ptr& checksums)
|
||||
bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& attributes)
|
||||
{
|
||||
auto originalAttrs (object->GetOriginalAttributes());
|
||||
|
||||
@ -1818,9 +1818,8 @@ IcingaDB::CreateConfigUpdate(const ConfigObject::Ptr& object, const String typeN
|
||||
return;
|
||||
|
||||
Dictionary::Ptr attr = new Dictionary;
|
||||
Dictionary::Ptr chksm = new Dictionary;
|
||||
|
||||
if (!PrepareObject(object, attr, chksm))
|
||||
if (!PrepareObject(object, attr))
|
||||
return;
|
||||
|
||||
InsertObjectDependencies(object, typeName, hMSets, runtimeUpdates, runtimeUpdate);
|
||||
|
@ -185,7 +185,7 @@ private:
|
||||
static String HashValue(const Value& value, const std::set<String>& propertiesBlacklist, bool propertiesWhitelist = false);
|
||||
|
||||
static String GetLowerCaseTypeNameDB(const ConfigObject::Ptr& obj);
|
||||
static bool PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& attributes, Dictionary::Ptr& checkSums);
|
||||
static bool PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& attributes);
|
||||
|
||||
static void ReachabilityChangeHandler(const std::set<Checkable::Ptr>& children);
|
||||
static void StateChangeHandler(const ConfigObject::Ptr& object, const CheckResult::Ptr& cr, StateType type);
|
||||
|
@ -16,7 +16,7 @@ namespace icinga
|
||||
class HistoryTable : public Table
|
||||
{
|
||||
public:
|
||||
virtual void UpdateLogEntries(const Dictionary::Ptr& bag, int line_count, int lineno, const AddRowFunction& addRowFn) = 0;
|
||||
virtual void UpdateLogEntries(const Dictionary::Ptr& bag, int lineno, const AddRowFunction& addRowFn) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -152,8 +152,8 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
|
||||
/* _1 = row, _2 = groupByType, _3 = groupByObject */
|
||||
Log(LogDebug, "Livestatus")
|
||||
<< "Processing hosts group by hostgroup table.";
|
||||
HostGroupsTable::AddColumns(table, "hostgroup_", [](const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) -> Value {
|
||||
return HostGroupAccessor(row, groupByType, groupByObject);
|
||||
HostGroupsTable::AddColumns(table, "hostgroup_", [](const Value&, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) -> Value {
|
||||
return HostGroupAccessor(groupByType, groupByObject);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ void HostsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||
}
|
||||
}
|
||||
|
||||
Object::Ptr HostsTable::HostGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
||||
Object::Ptr HostsTable::HostGroupAccessor(LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
||||
{
|
||||
/* return the current group by value set from within FetchRows()
|
||||
* this is the hostgrouo object used for the table join inside
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
protected:
|
||||
void FetchRows(const AddRowFunction& addRowFn) override;
|
||||
|
||||
static Object::Ptr HostGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject);
|
||||
static Object::Ptr HostGroupAccessor(LivestatusGroupByType groupByType, const Object::Ptr& groupByObject);
|
||||
|
||||
static Value NameAccessor(const Value& row);
|
||||
static Value DisplayNameAccessor(const Value& row);
|
||||
|
@ -59,7 +59,6 @@ void LivestatusLogUtility::CreateLogCache(std::map<time_t, String> index, Histor
|
||||
ASSERT(table);
|
||||
|
||||
/* m_LogFileIndex map tells which log files are involved ordered by their start timestamp */
|
||||
unsigned long line_count = 0;
|
||||
for (const auto& kv : index) {
|
||||
unsigned int ts = kv.first;
|
||||
|
||||
@ -90,9 +89,8 @@ void LivestatusLogUtility::CreateLogCache(std::map<time_t, String> index, Histor
|
||||
continue;
|
||||
}
|
||||
|
||||
table->UpdateLogEntries(log_entry_attrs, line_count, lineno, addRowFn);
|
||||
table->UpdateLogEntries(log_entry_attrs, lineno, addRowFn);
|
||||
|
||||
line_count++;
|
||||
lineno++;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ void LogTable::FetchRows(const AddRowFunction& addRowFn)
|
||||
}
|
||||
|
||||
/* gets called in LivestatusLogUtility::CreateLogCache */
|
||||
void LogTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn)
|
||||
void LogTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int lineno, const AddRowFunction& addRowFn)
|
||||
{
|
||||
/* additional attributes only for log table */
|
||||
log_entry_attrs->Set("lineno", lineno);
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
String GetName() const override;
|
||||
String GetPrefix() const override;
|
||||
|
||||
void UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn) override;
|
||||
void UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int lineno, const AddRowFunction& addRowFn) override;
|
||||
|
||||
protected:
|
||||
void FetchRows(const AddRowFunction& addRowFn) override;
|
||||
|
@ -129,15 +129,15 @@ void ServicesTable::AddColumns(Table *table, const String& prefix,
|
||||
/* _1 = row, _2 = groupByType, _3 = groupByObject */
|
||||
Log(LogDebug, "Livestatus")
|
||||
<< "Processing services group by servicegroup table.";
|
||||
ServiceGroupsTable::AddColumns(table, "servicegroup_", [](const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) -> Value {
|
||||
return ServiceGroupAccessor(row, groupByType, groupByObject);
|
||||
ServiceGroupsTable::AddColumns(table, "servicegroup_", [](const Value&, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) -> Value {
|
||||
return ServiceGroupAccessor(groupByType, groupByObject);
|
||||
});
|
||||
} else if (table->GetGroupByType() == LivestatusGroupByHostGroup) {
|
||||
/* _1 = row, _2 = groupByType, _3 = groupByObject */
|
||||
Log(LogDebug, "Livestatus")
|
||||
<< "Processing services group by hostgroup table.";
|
||||
HostGroupsTable::AddColumns(table, "hostgroup_", [](const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) -> Value {
|
||||
return HostGroupAccessor(row, groupByType, groupByObject);
|
||||
HostGroupsTable::AddColumns(table, "hostgroup_", [](const Value&, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) -> Value {
|
||||
return HostGroupAccessor(groupByType, groupByObject);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ Object::Ptr ServicesTable::HostAccessor(const Value& row, const Column::ObjectAc
|
||||
return svc->GetHost();
|
||||
}
|
||||
|
||||
Object::Ptr ServicesTable::ServiceGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
||||
Object::Ptr ServicesTable::ServiceGroupAccessor(LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
||||
{
|
||||
/* return the current group by value set from within FetchRows()
|
||||
* this is the servicegroup object used for the table join inside
|
||||
@ -211,7 +211,7 @@ Object::Ptr ServicesTable::ServiceGroupAccessor(const Value& row, LivestatusGrou
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Object::Ptr ServicesTable::HostGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
||||
Object::Ptr ServicesTable::HostGroupAccessor(LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
||||
{
|
||||
/* return the current group by value set from within FetchRows()
|
||||
* this is the servicegroup object used for the table join inside
|
||||
|
@ -30,8 +30,8 @@ protected:
|
||||
void FetchRows(const AddRowFunction& addRowFn) override;
|
||||
|
||||
static Object::Ptr HostAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
|
||||
static Object::Ptr ServiceGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject);
|
||||
static Object::Ptr HostGroupAccessor(const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject);
|
||||
static Object::Ptr ServiceGroupAccessor(LivestatusGroupByType groupByType, const Object::Ptr& groupByObject);
|
||||
static Object::Ptr HostGroupAccessor(LivestatusGroupByType groupByType, const Object::Ptr& groupByObject);
|
||||
|
||||
static Value ShortNameAccessor(const Value& row);
|
||||
static Value DisplayNameAccessor(const Value& row);
|
||||
|
@ -36,7 +36,7 @@ StateHistTable::StateHistTable(const String& compat_log_path, time_t from, time_
|
||||
AddColumns(this);
|
||||
}
|
||||
|
||||
void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn)
|
||||
void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int lineno, const AddRowFunction&)
|
||||
{
|
||||
unsigned int time = log_entry_attrs->Get("time");
|
||||
String host_name = log_entry_attrs->Get("host_name");
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
String GetName() const override;
|
||||
String GetPrefix() const override;
|
||||
|
||||
void UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn) override;
|
||||
void UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int lineno, const AddRowFunction& addRowFn) override;
|
||||
|
||||
protected:
|
||||
void FetchRows(const AddRowFunction& addRowFn) override;
|
||||
|
@ -53,7 +53,7 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
||||
};
|
||||
}
|
||||
|
||||
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(),
|
||||
PluginUtility::ExecuteCommand(commandObj, checkable->GetLastCheckResult(),
|
||||
resolvers, resolvedMacros, useResolvedMacros, timeout, callback);
|
||||
|
||||
if (!resolvedMacros || useResolvedMacros) {
|
||||
|
@ -45,7 +45,7 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
||||
callback = [checkable](const Value& commandLine, const ProcessResult& pr) { ProcessFinishedHandler(checkable, commandLine, pr); };
|
||||
}
|
||||
|
||||
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(),
|
||||
PluginUtility::ExecuteCommand(commandObj, checkable->GetLastCheckResult(),
|
||||
resolvers, resolvedMacros, useResolvedMacros, timeout, callback);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
|
||||
callback = [checkable](const Value& commandline, const ProcessResult& pr) { ProcessFinishedHandler(checkable, commandline, pr); };
|
||||
}
|
||||
|
||||
PluginUtility::ExecuteCommand(commandObj, checkable, cr, resolvers,
|
||||
PluginUtility::ExecuteCommand(commandObj, cr, resolvers,
|
||||
resolvedMacros, useResolvedMacros, timeout, callback);
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ void OpenTsdbWriter::Resume()
|
||||
Log(LogInformation, "OpentsdbWriter")
|
||||
<< "'" << GetName() << "' resumed.";
|
||||
|
||||
ReadConfigTemplate(m_ServiceConfigTemplate, m_HostConfigTemplate);
|
||||
ReadConfigTemplate();
|
||||
|
||||
m_ReconnectTimer = Timer::Create();
|
||||
m_ReconnectTimer->SetInterval(10);
|
||||
@ -455,8 +455,7 @@ String OpenTsdbWriter::EscapeMetric(const String& str)
|
||||
* @param stemplate The dictionary to save the service configuration to
|
||||
* @param htemplate The dictionary to save the host configuration to
|
||||
*/
|
||||
void OpenTsdbWriter::ReadConfigTemplate(const Dictionary::Ptr& stemplate,
|
||||
const Dictionary::Ptr& htemplate)
|
||||
void OpenTsdbWriter::ReadConfigTemplate()
|
||||
{
|
||||
|
||||
m_ServiceConfigTemplate = GetServiceTemplate();
|
||||
|
@ -53,8 +53,7 @@ private:
|
||||
|
||||
void ReconnectTimerHandler();
|
||||
|
||||
void ReadConfigTemplate(const Dictionary::Ptr& stemplate,
|
||||
const Dictionary::Ptr& htemplate);
|
||||
void ReadConfigTemplate();
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ void ApiListener::Start(bool runtimeCreated)
|
||||
RenewCA();
|
||||
});
|
||||
} else {
|
||||
m_RenewOwnCertTimer->OnTimerExpired.connect([this](const Timer * const&) {
|
||||
m_RenewOwnCertTimer->OnTimerExpired.connect([](const Timer * const&) {
|
||||
JsonRpcConnection::SendCertificateRequest(nullptr, nullptr, String());
|
||||
});
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class ApiListener : ConfigObject
|
||||
default {{{ return -1; }}}
|
||||
};
|
||||
|
||||
[config, deprecated] double tls_handshake_timeout {
|
||||
[config, deprecated, no_storage] double tls_handshake_timeout {
|
||||
get;
|
||||
set;
|
||||
default {{{ return Configuration::TlsHandshakeTimeout; }}}
|
||||
|
@ -28,11 +28,11 @@ bool ConfigPackagesHandler::HandleRequest(
|
||||
return false;
|
||||
|
||||
if (request.method() == http::verb::get)
|
||||
HandleGet(user, request, url, response, params);
|
||||
HandleGet(user, response, params);
|
||||
else if (request.method() == http::verb::post)
|
||||
HandlePost(user, request, url, response, params);
|
||||
HandlePost(user, url, response, params);
|
||||
else if (request.method() == http::verb::delete_)
|
||||
HandleDelete(user, request, url, response, params);
|
||||
HandleDelete(user, url, response, params);
|
||||
else
|
||||
return false;
|
||||
|
||||
@ -41,8 +41,6 @@ bool ConfigPackagesHandler::HandleRequest(
|
||||
|
||||
void ConfigPackagesHandler::HandleGet(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
)
|
||||
@ -91,7 +89,6 @@ void ConfigPackagesHandler::HandleGet(
|
||||
|
||||
void ConfigPackagesHandler::HandlePost(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
@ -137,7 +134,6 @@ void ConfigPackagesHandler::HandlePost(
|
||||
|
||||
void ConfigPackagesHandler::HandleDelete(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
|
@ -28,21 +28,17 @@ public:
|
||||
private:
|
||||
void HandleGet(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
);
|
||||
void HandlePost(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
);
|
||||
void HandleDelete(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
|
@ -32,11 +32,11 @@ bool ConfigStagesHandler::HandleRequest(
|
||||
return false;
|
||||
|
||||
if (request.method() == http::verb::get)
|
||||
HandleGet(user, request, url, response, params);
|
||||
HandleGet(user, url, response, params);
|
||||
else if (request.method() == http::verb::post)
|
||||
HandlePost(user, request, url, response, params);
|
||||
HandlePost(user, url, response, params);
|
||||
else if (request.method() == http::verb::delete_)
|
||||
HandleDelete(user, request, url, response, params);
|
||||
HandleDelete(user, url, response, params);
|
||||
else
|
||||
return false;
|
||||
|
||||
@ -45,7 +45,6 @@ bool ConfigStagesHandler::HandleRequest(
|
||||
|
||||
void ConfigStagesHandler::HandleGet(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
@ -93,7 +92,6 @@ void ConfigStagesHandler::HandleGet(
|
||||
|
||||
void ConfigStagesHandler::HandlePost(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
@ -176,7 +174,6 @@ void ConfigStagesHandler::HandlePost(
|
||||
|
||||
void ConfigStagesHandler::HandleDelete(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
|
@ -29,21 +29,18 @@ public:
|
||||
private:
|
||||
void HandleGet(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
);
|
||||
void HandlePost(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
);
|
||||
void HandleDelete(
|
||||
const ApiUser::Ptr& user,
|
||||
boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
const Url::Ptr& url,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params
|
||||
|
@ -96,16 +96,15 @@ bool ConsoleHandler::HandleRequest(
|
||||
}
|
||||
|
||||
if (methodName == "execute-script")
|
||||
return ExecuteScriptHelper(request, response, params, command, session, sandboxed);
|
||||
return ExecuteScriptHelper(response, params, command, session, sandboxed);
|
||||
else if (methodName == "auto-complete-script")
|
||||
return AutocompleteScriptHelper(request, response, params, command, session, sandboxed);
|
||||
return AutocompleteScriptHelper(response, params, command, session, sandboxed);
|
||||
|
||||
HttpUtility::SendJsonError(response, params, 400, "Invalid method specified: " + methodName);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConsoleHandler::ExecuteScriptHelper(boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
bool ConsoleHandler::ExecuteScriptHelper(boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params, const String& command, const String& session, bool sandboxed)
|
||||
{
|
||||
namespace http = boost::beast::http;
|
||||
@ -179,8 +178,7 @@ bool ConsoleHandler::ExecuteScriptHelper(boost::beast::http::request<boost::beas
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConsoleHandler::AutocompleteScriptHelper(boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
bool ConsoleHandler::AutocompleteScriptHelper(boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params, const String& command, const String& session, bool sandboxed)
|
||||
{
|
||||
namespace http = boost::beast::http;
|
||||
|
@ -37,11 +37,9 @@ public:
|
||||
static std::vector<String> GetAutocompletionSuggestions(const String& word, ScriptFrame& frame);
|
||||
|
||||
private:
|
||||
static bool ExecuteScriptHelper(boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
static bool ExecuteScriptHelper(boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params, const String& command, const String& session, bool sandboxed);
|
||||
static bool AutocompleteScriptHelper(boost::beast::http::request<boost::beast::http::string_body>& request,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
static bool AutocompleteScriptHelper(boost::beast::http::response<boost::beast::http::string_body>& response,
|
||||
const Dictionary::Ptr& params, const String& command, const String& session, bool sandboxed);
|
||||
|
||||
};
|
||||
|
@ -205,8 +205,6 @@ String Url::Format(bool onlyPathAndQuery, bool printCredentials) const
|
||||
|
||||
String param;
|
||||
if (!m_Query.empty()) {
|
||||
typedef std::pair<String, std::vector<String> > kv_pair;
|
||||
|
||||
for (const auto& kv : m_Query) {
|
||||
String key = Utility::EscapeString(kv.first, ACQUERY_ENCODE, false);
|
||||
if (param.IsEmpty())
|
||||
|
@ -396,7 +396,6 @@ void AdvancedHelper(const char *timestamp, DateTime from, DateTime to)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(advanced)
|
||||
{
|
||||
tm tm_beg, tm_end, tm_ref;
|
||||
String timestamp;
|
||||
boost::posix_time::ptime begin;
|
||||
boost::posix_time::ptime end;
|
||||
|
Loading…
x
Reference in New Issue
Block a user