Merge pull request #5939 from Icinga/fix/build-fix-wheezy

Build fix for Debian wheezy
This commit is contained in:
Michael Friedrich 2018-01-03 11:28:57 +01:00 committed by GitHub
commit 0e6f4b1966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 30 additions and 30 deletions

View File

@ -180,7 +180,7 @@ static int Main(void)
try {
expression = ConfigCompiler::CompileFile(initconfig);
ScriptFrame frame;
ScriptFrame frame(true);
expression->Evaluate(frame);
} catch (const std::exception& ex) {
Log(LogCritical, "config", DiagnosticInformation(ex));

View File

@ -44,7 +44,7 @@ Value Function::Invoke(const std::vector<Value>& arguments)
Value Function::InvokeThis(const Value& otherThis, const std::vector<Value>& arguments)
{
ScriptFrame frame(otherThis, false);
ScriptFrame frame(false, otherThis);
return m_Callback(arguments);
}

View File

@ -46,7 +46,7 @@ ScriptFrame::ScriptFrame(bool allocLocals)
InitializeFrame();
}
ScriptFrame::ScriptFrame(const Value& self, bool allocLocals)
ScriptFrame::ScriptFrame(bool allocLocals, const Value& self)
: Locals(allocLocals ? new Dictionary() : nullptr), Self(self), Sandboxed(false), Depth(0)
{
InitializeFrame();

View File

@ -36,8 +36,8 @@ struct ScriptFrame
bool Sandboxed;
int Depth;
ScriptFrame(bool allocLocals = true);
ScriptFrame(const Value& self, bool allocLocals = true);
ScriptFrame(bool allocLocals);
ScriptFrame(bool allocLocals, const Value& self);
~ScriptFrame(void);
void IncreaseStackDepth(void);

View File

@ -50,7 +50,7 @@ INITIALIZE_ONCE(&ConsoleCommand::StaticInitialize);
extern "C" void dbg_spawn_console(void)
{
ScriptFrame frame;
ScriptFrame frame(true);
ConsoleCommand::RunScriptConsole(frame);
}
@ -71,7 +71,7 @@ extern "C" void dbg_eval(const char *text)
std::unique_ptr<Expression> expr;
try {
ScriptFrame frame;
ScriptFrame frame(true);
expr = ConfigCompiler::CompileText("<dbg>", text);
Value result = Serialize(expr->Evaluate(frame), 0);
dbg_inspect_value(result);
@ -85,7 +85,7 @@ extern "C" void dbg_eval_with_value(const Value& value, const char *text)
std::unique_ptr<Expression> expr;
try {
ScriptFrame frame;
ScriptFrame frame(true);
frame.Locals = new Dictionary();
frame.Locals->Set("arg", value);
expr = ConfigCompiler::CompileText("<dbg>", text);
@ -101,7 +101,7 @@ extern "C" void dbg_eval_with_object(Object *object, const char *text)
std::unique_ptr<Expression> expr;
try {
ScriptFrame frame;
ScriptFrame frame(true);
frame.Locals = new Dictionary();
frame.Locals->Set("arg", object);
expr = ConfigCompiler::CompileText("<dbg>", text);
@ -227,7 +227,7 @@ int ConsoleCommand::Run(const po::variables_map& vm, const std::vector<std::stri
#endif /* HAVE_EDITLINE */
String addr, session;
ScriptFrame scriptFrame;
ScriptFrame scriptFrame(true);
session = Utility::NewUniqueID();

View File

@ -34,7 +34,7 @@ static bool ExecuteExpression(Expression *expression)
return false;
try {
ScriptFrame frame;
ScriptFrame frame(true);
expression->Evaluate(frame);
} catch (const std::exception& ex) {
Log(LogCritical, "config", DiagnosticInformation(ex));

View File

@ -31,7 +31,7 @@
std::unique_ptr<icinga::Expression> expression = icinga::ConfigCompiler::CompileText(name, fragment); \
VERIFY(expression); \
try { \
icinga::ScriptFrame frame; \
icinga::ScriptFrame frame(true); \
expression->Evaluate(frame); \
} catch (const std::exception& ex) { \
std::cerr << icinga::DiagnosticInformation(ex) << std::endl; \

View File

@ -196,7 +196,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
DebugHint debugHints;
ScriptFrame frame(dobj);
ScriptFrame frame(true, dobj);
if (m_Scope)
m_Scope->CopyTo(frame.Locals);
try {
@ -584,7 +584,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr
if (expression) {
try {
ScriptFrame frame;
ScriptFrame frame(true);
expression->Evaluate(frame);
} catch (const std::exception& ex) {
Log(LogCritical, "config", DiagnosticInformation(ex));

View File

@ -91,7 +91,7 @@ bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyR
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
ScriptFrame frame;
ScriptFrame frame(true);
if (rule.GetScope())
rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);

View File

@ -41,7 +41,7 @@ bool HostGroup::EvaluateObjectRule(const Host::Ptr& host, const ConfigItem::Ptr&
CONTEXT("Evaluating rule for group '" + group_name + "'");
ScriptFrame frame;
ScriptFrame frame(true);
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);

View File

@ -90,7 +90,7 @@ bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const Appl
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
ScriptFrame frame;
ScriptFrame frame(true);
if (rule.GetScope())
rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);

View File

@ -89,7 +89,7 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
ScriptFrame frame;
ScriptFrame frame(true);
if (rule.GetScope())
rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);

View File

@ -80,7 +80,7 @@ bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
msgbuf << "Evaluating 'apply' rule (" << di << ")";
CONTEXT(msgbuf.str());
ScriptFrame frame;
ScriptFrame frame(true);
if (rule.GetScope())
rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);

View File

@ -43,7 +43,7 @@ bool ServiceGroup::EvaluateObjectRule(const Service::Ptr& service, const ConfigI
Host::Ptr host = service->GetHost();
ScriptFrame frame;
ScriptFrame frame(true);
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);

View File

@ -41,7 +41,7 @@ bool UserGroup::EvaluateObjectRule(const User::Ptr& user, const ConfigItem::Ptr&
CONTEXT("Evaluating rule for group '" + group_name + "'");
ScriptFrame frame;
ScriptFrame frame(true);
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("user", user);

View File

@ -129,7 +129,7 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
try {
ActivationScope ascope;
ScriptFrame frame;
ScriptFrame frame(true);
expr->Evaluate(frame);
expr.reset();

View File

@ -129,7 +129,7 @@ bool ConsoleHandler::ExecuteScriptHelper(HttpRequest& request, HttpResponse& res
try {
expr = ConfigCompiler::CompileText(fileName, command);
ScriptFrame frame;
ScriptFrame frame(true);
frame.Locals = lsf.Locals;
frame.Self = lsf.Locals;
frame.Sandboxed = sandboxed;
@ -190,7 +190,7 @@ bool ConsoleHandler::AutocompleteScriptHelper(HttpRequest& request, HttpResponse
Array::Ptr results = new Array();
Dictionary::Ptr resultInfo = new Dictionary();
ScriptFrame frame;
ScriptFrame frame(true);
frame.Locals = lsf.Locals;
frame.Self = lsf.Locals;
frame.Sandboxed = sandboxed;

View File

@ -37,7 +37,7 @@ bool EventQueue::CanProcessEvent(const String& type) const
void EventQueue::ProcessEvent(const Dictionary::Ptr& event)
{
ScriptFrame frame;
ScriptFrame frame(true);
frame.Sandboxed = true;
try {

View File

@ -197,7 +197,7 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
Expression *permissionFilter;
CheckPermission(user, qd.Permission, &permissionFilter);
ScriptFrame permissionFrame;
ScriptFrame permissionFrame(true);
for (const String& type : qd.Types) {
String attr = type;
@ -247,7 +247,7 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
if (qd.Types.find(type) == qd.Types.end())
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type specified for this query."));
ScriptFrame frame;
ScriptFrame frame(true);
frame.Sandboxed = true;
Dictionary::Ptr uvars = new Dictionary();

View File

@ -27,7 +27,7 @@ BOOST_AUTO_TEST_SUITE(config_ops)
BOOST_AUTO_TEST_CASE(simple)
{
ScriptFrame frame;
ScriptFrame frame(true);
std::unique_ptr<Expression> expr;
Dictionary::Ptr dict;
@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE(simple)
BOOST_AUTO_TEST_CASE(advanced)
{
ScriptFrame frame;
ScriptFrame frame(true);
std::unique_ptr<Expression> expr;
Function::Ptr func;
@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(advanced)
BOOST_CHECK_THROW(expr->Evaluate(frame).GetValue(), ScriptError);
Object::Ptr self = new Object();
ScriptFrame frame2(self);
ScriptFrame frame2(true, self);
expr = ConfigCompiler::CompileText("<test>", "this");
BOOST_CHECK(expr->Evaluate(frame2).GetValue() == Value(self));