mirror of https://github.com/Icinga/icinga2.git
parent
827125a69a
commit
1f63bcb1b3
|
@ -106,7 +106,7 @@ static char *ConsoleCompleteHelper(const char *word, int state)
|
||||||
Value value;
|
Value value;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Expression *expr = ConfigCompiler::CompileText("temp", pword, false);
|
Expression *expr = ConfigCompiler::CompileText("temp", pword);
|
||||||
|
|
||||||
if (expr)
|
if (expr)
|
||||||
value = expr->Evaluate(*l_ScriptFrame);
|
value = expr->Evaluate(*l_ScriptFrame);
|
||||||
|
@ -238,7 +238,7 @@ incomplete:
|
||||||
try {
|
try {
|
||||||
lines[fileName] = command;
|
lines[fileName] = command;
|
||||||
|
|
||||||
expr = ConfigCompiler::CompileText(fileName, command, false);
|
expr = ConfigCompiler::CompileText(fileName, command);
|
||||||
|
|
||||||
if (expr) {
|
if (expr) {
|
||||||
Value result = expr->Evaluate(scriptFrame);
|
Value result = expr->Evaluate(scriptFrame);
|
||||||
|
|
|
@ -74,7 +74,7 @@ static void IncludeModule(const String& modulePath, bool& success)
|
||||||
|
|
||||||
if (Utility::PathExists(modulePath + "/include.conf")) {
|
if (Utility::PathExists(modulePath + "/include.conf")) {
|
||||||
Expression *expr = ConfigCompiler::CompileFile(modulePath + "/include.conf",
|
Expression *expr = ConfigCompiler::CompileFile(modulePath + "/include.conf",
|
||||||
true, String(), moduleName);
|
String(), moduleName);
|
||||||
|
|
||||||
if (!ExecuteExpression(expr))
|
if (!ExecuteExpression(expr))
|
||||||
success = false;
|
success = false;
|
||||||
|
@ -91,7 +91,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
|
||||||
|
|
||||||
if (!configs.empty()) {
|
if (!configs.empty()) {
|
||||||
BOOST_FOREACH(const String& configPath, configs) {
|
BOOST_FOREACH(const String& configPath, configs) {
|
||||||
Expression *expression = ConfigCompiler::CompileFile(configPath, true, String(), "_etc");
|
Expression *expression = ConfigCompiler::CompileFile(configPath, String(), "_etc");
|
||||||
success = ExecuteExpression(expression);
|
success = ExecuteExpression(expression);
|
||||||
delete expression;
|
delete expression;
|
||||||
if (!success)
|
if (!success)
|
||||||
|
|
|
@ -113,7 +113,7 @@ String ConfigCompiler::GetModule(void) const
|
||||||
void ConfigCompiler::CollectIncludes(std::vector<Expression *>& expressions,
|
void ConfigCompiler::CollectIncludes(std::vector<Expression *>& expressions,
|
||||||
const String& file, const String& zone, const String& module)
|
const String& file, const String& zone, const String& module)
|
||||||
{
|
{
|
||||||
expressions.push_back(CompileFile(file, true, zone, module));
|
expressions.push_back(CompileFile(file, zone, module));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +235,7 @@ void ConfigCompiler::HandleLibrary(const String& library)
|
||||||
* @returns Configuration items.
|
* @returns Configuration items.
|
||||||
*/
|
*/
|
||||||
Expression *ConfigCompiler::CompileStream(const String& path,
|
Expression *ConfigCompiler::CompileStream(const String& path,
|
||||||
std::istream *stream, bool async, const String& zone, const String& module)
|
std::istream *stream, const String& zone, const String& module)
|
||||||
{
|
{
|
||||||
CONTEXT("Compiling configuration stream with name '" + path + "'");
|
CONTEXT("Compiling configuration stream with name '" + path + "'");
|
||||||
|
|
||||||
|
@ -258,8 +258,8 @@ Expression *ConfigCompiler::CompileStream(const String& path,
|
||||||
* @param path The path.
|
* @param path The path.
|
||||||
* @returns Configuration items.
|
* @returns Configuration items.
|
||||||
*/
|
*/
|
||||||
Expression *ConfigCompiler::CompileFile(const String& path, bool async,
|
Expression *ConfigCompiler::CompileFile(const String& path, const String& zone,
|
||||||
const String& zone, const String& module)
|
const String& module)
|
||||||
{
|
{
|
||||||
CONTEXT("Compiling configuration file '" + path + "'");
|
CONTEXT("Compiling configuration file '" + path + "'");
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ Expression *ConfigCompiler::CompileFile(const String& path, bool async,
|
||||||
Log(LogInformation, "ConfigCompiler")
|
Log(LogInformation, "ConfigCompiler")
|
||||||
<< "Compiling config file: " << path;
|
<< "Compiling config file: " << path;
|
||||||
|
|
||||||
return CompileStream(path, &stream, async, zone, module);
|
return CompileStream(path, &stream, zone, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -285,10 +285,10 @@ Expression *ConfigCompiler::CompileFile(const String& path, bool async,
|
||||||
* @returns Configuration items.
|
* @returns Configuration items.
|
||||||
*/
|
*/
|
||||||
Expression *ConfigCompiler::CompileText(const String& path, const String& text,
|
Expression *ConfigCompiler::CompileText(const String& path, const String& text,
|
||||||
bool async, const String& zone, const String& module)
|
const String& zone, const String& module)
|
||||||
{
|
{
|
||||||
std::stringstream stream(text);
|
std::stringstream stream(text);
|
||||||
return CompileStream(path, &stream, async, zone, module);
|
return CompileStream(path, &stream, zone, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,11 +86,11 @@ public:
|
||||||
Expression *Compile(void);
|
Expression *Compile(void);
|
||||||
|
|
||||||
static Expression *CompileStream(const String& path, std::istream *stream,
|
static Expression *CompileStream(const String& path, std::istream *stream,
|
||||||
bool async = true, const String& zone = String(), const String& module = String());
|
|
||||||
static Expression *CompileFile(const String& path, bool async = true,
|
|
||||||
const String& zone = String(), const String& module = String());
|
const String& zone = String(), const String& module = String());
|
||||||
|
static Expression *CompileFile(const String& path, const String& zone = String(),
|
||||||
|
const String& module = String());
|
||||||
static Expression *CompileText(const String& path, const String& text,
|
static Expression *CompileText(const String& path, const String& text,
|
||||||
bool async = true, const String& zone = String(), const String& module = String());
|
const String& zone = String(), const String& module = String());
|
||||||
|
|
||||||
static void AddIncludeSearchDir(const String& dir);
|
static void AddIncludeSearchDir(const String& dir);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
namespace { \
|
namespace { \
|
||||||
void RegisterConfigFragment(void) \
|
void RegisterConfigFragment(void) \
|
||||||
{ \
|
{ \
|
||||||
icinga::Expression *expression = icinga::ConfigCompiler::CompileText(name, fragment, false); \
|
icinga::Expression *expression = icinga::ConfigCompiler::CompileText(name, fragment); \
|
||||||
VERIFY(expression); \
|
VERIFY(expression); \
|
||||||
icinga::ScriptFrame frame; \
|
icinga::ScriptFrame frame; \
|
||||||
expression->Evaluate(frame); \
|
expression->Evaluate(frame); \
|
||||||
|
|
|
@ -633,7 +633,7 @@ void LivestatusQuery::ExecuteScriptHelper(const Stream::Ptr& stream)
|
||||||
Expression *expr = NULL;
|
Expression *expr = NULL;
|
||||||
Value result;
|
Value result;
|
||||||
try {
|
try {
|
||||||
expr = ConfigCompiler::CompileText(fileName, m_Command, false);
|
expr = ConfigCompiler::CompileText(fileName, m_Command);
|
||||||
ScriptFrame frame;
|
ScriptFrame frame;
|
||||||
frame.Locals = lsf.Locals;
|
frame.Locals = lsf.Locals;
|
||||||
frame.Self = lsf.Locals;
|
frame.Self = lsf.Locals;
|
||||||
|
|
|
@ -114,7 +114,7 @@ std::vector<ConfigObject::Ptr> FilterUtility::GetFilterTargets(const QueryDescri
|
||||||
ConfigType::Ptr dtype = ConfigType::GetByName(type);
|
ConfigType::Ptr dtype = ConfigType::GetByName(type);
|
||||||
ASSERT(dtype);
|
ASSERT(dtype);
|
||||||
|
|
||||||
Expression *ufilter = ConfigCompiler::CompileText("<API query>", filter, false);
|
Expression *ufilter = ConfigCompiler::CompileText("<API query>", filter);
|
||||||
ScriptFrame frame;
|
ScriptFrame frame;
|
||||||
frame.Sandboxed = true;
|
frame.Sandboxed = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue