MCPcopy Create free account
hub / github.com/Icinga/icinga2 / CompileFile

Method CompileFile

lib/config/configcompiler.cpp:260–277  ·  view source on GitHub ↗

* Compiles a file. * * @param path The path. * @returns Configuration items. */

Source from the content-addressed store, hash-verified

258 * @returns Configuration items.
259 */
260std::unique_ptr<Expression> ConfigCompiler::CompileFile(const String& path, const String& zone,
261 const String& package)
262{
263 CONTEXT("Compiling configuration file '" << path << "'");
264
265 std::ifstream stream(path.CStr(), std::ifstream::in);
266
267 if (!stream)
268 BOOST_THROW_EXCEPTION(posix_error()
269 << boost::errinfo_api_function("std::ifstream::open")
270 << boost::errinfo_errno(errno)
271 << boost::errinfo_file_name(path));
272
273 Log(LogNotice, "ConfigCompiler")
274 << "Compiling config file: " << path;
275
276 return CompileStream(path, &stream, zone, package);
277}
278
279/**
280 * Compiles a snippet of text.

Callers

nothing calls this directly

Calls 3

posix_errorClass · 0.85
LogClass · 0.85
CStrMethod · 0.80

Tested by

no test coverage detected