mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 08:04:14 +02:00
parent
bdaf02295f
commit
288413f046
@ -34,7 +34,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
@ -243,7 +242,7 @@ int Main(void)
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
if (vm.count("define")) {
|
if (vm.count("define")) {
|
||||||
BOOST_FOREACH(const String& define, vm["define"].as<std::vector<std::string> >()) {
|
for (const String& define : vm["define"].as<std::vector<std::string> >()) {
|
||||||
String key, value;
|
String key, value;
|
||||||
size_t pos = define.FindFirstOf('=');
|
size_t pos = define.FindFirstOf('=');
|
||||||
if (pos != String::NPos) {
|
if (pos != String::NPos) {
|
||||||
@ -269,7 +268,7 @@ int Main(void)
|
|||||||
ConfigCompiler::AddIncludeSearchDir(Application::GetIncludeConfDir());
|
ConfigCompiler::AddIncludeSearchDir(Application::GetIncludeConfDir());
|
||||||
|
|
||||||
if (!autocomplete && vm.count("include")) {
|
if (!autocomplete && vm.count("include")) {
|
||||||
BOOST_FOREACH(const String& includePath, vm["include"].as<std::vector<std::string> >()) {
|
for (const String& includePath : vm["include"].as<std::vector<std::string> >()) {
|
||||||
ConfigCompiler::AddIncludeSearchDir(includePath);
|
ConfigCompiler::AddIncludeSearchDir(includePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +292,7 @@ int Main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count("library")) {
|
if (vm.count("library")) {
|
||||||
BOOST_FOREACH(const String& libraryName, vm["library"].as<std::vector<std::string> >()) {
|
for (const String& libraryName : vm["library"].as<std::vector<std::string> >()) {
|
||||||
try {
|
try {
|
||||||
(void) Loader::LoadExtensionLibrary(libraryName);
|
(void) Loader::LoadExtensionLibrary(libraryName);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "icinga-studio/aboutform.hpp"
|
#include "icinga-studio/aboutform.hpp"
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -72,11 +71,11 @@ void MainForm::TypesCompletionHandler(boost::exception_ptr eptr, const std::vect
|
|||||||
|
|
||||||
wxTreeItemId rootNode = m_TypesTree->AddRoot("root");
|
wxTreeItemId rootNode = m_TypesTree->AddRoot("root");
|
||||||
|
|
||||||
BOOST_FOREACH(const ApiType::Ptr& type, types) {
|
for (const ApiType::Ptr& type : types) {
|
||||||
m_Types[type->Name] = type;
|
m_Types[type->Name] = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const ApiType::Ptr& type, types) {
|
for (const ApiType::Ptr& type : types) {
|
||||||
if (type->Abstract)
|
if (type->Abstract)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -146,7 +145,7 @@ void MainForm::ObjectsCompletionHandler(boost::exception_ptr eptr, const std::ve
|
|||||||
std::vector<ApiObject::Ptr> sortedObjects = objects;
|
std::vector<ApiObject::Ptr> sortedObjects = objects;
|
||||||
std::sort(sortedObjects.begin(), sortedObjects.end(), ApiObjectLessComparer);
|
std::sort(sortedObjects.begin(), sortedObjects.end(), ApiObjectLessComparer);
|
||||||
|
|
||||||
BOOST_FOREACH(const ApiObject::Ptr& object, sortedObjects) {
|
for (const ApiObject::Ptr& object : sortedObjects) {
|
||||||
std::string name = object->Name;
|
std::string name = object->Name;
|
||||||
m_ObjectsList->InsertItem(0, name);
|
m_ObjectsList->InsertItem(0, name);
|
||||||
}
|
}
|
||||||
@ -195,7 +194,7 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value)
|
|||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(arr);
|
ObjectLock olock(arr);
|
||||||
BOOST_FOREACH(const Value& aitem, arr) {
|
for (const Value& aitem : arr) {
|
||||||
String val1 = aitem;
|
String val1 = aitem;
|
||||||
val.Add(val1.GetData());
|
val.Add(val1.GetData());
|
||||||
}
|
}
|
||||||
@ -211,7 +210,7 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value)
|
|||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(dict);
|
ObjectLock olock(dict);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
|
for (const Dictionary::Pair& kv : dict) {
|
||||||
if (kv.first != "type")
|
if (kv.first != "type")
|
||||||
prop->AppendChild(ValueToProperty(kv.first, kv.second));
|
prop->AppendChild(ValueToProperty(kv.first, kv.second));
|
||||||
}
|
}
|
||||||
@ -268,8 +267,7 @@ void MainForm::ObjectDetailsCompletionHandler(boost::exception_ptr eptr, const s
|
|||||||
|
|
||||||
std::map<String, wxStringProperty *> parents;
|
std::map<String, wxStringProperty *> parents;
|
||||||
|
|
||||||
typedef std::pair<String, Value> kv_pair_attr;
|
for (const auto& kv : object->Attrs) {
|
||||||
BOOST_FOREACH(const kv_pair_attr& kv, object->Attrs) {
|
|
||||||
std::vector<String> tokens;
|
std::vector<String> tokens;
|
||||||
boost::algorithm::split(tokens, kv.first, boost::is_any_of("."));
|
boost::algorithm::split(tokens, kv.first, boost::is_any_of("."));
|
||||||
|
|
||||||
@ -298,8 +296,7 @@ void MainForm::ObjectDetailsCompletionHandler(boost::exception_ptr eptr, const s
|
|||||||
parents.erase(propName);
|
parents.erase(propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::pair<String, wxStringProperty *> kv_pair_prop;
|
for (const auto& kv : parents) {
|
||||||
BOOST_FOREACH(const kv_pair_prop& kv, parents) {
|
|
||||||
m_PropertyGrid->Append(kv.second);
|
m_PropertyGrid->Append(kv.second);
|
||||||
m_PropertyGrid->SetPropertyReadOnly(kv.second);
|
m_PropertyGrid->SetPropertyReadOnly(kv.second);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include "base/process.hpp"
|
#include "base/process.hpp"
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <boost/algorithm/string/trim.hpp>
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
#include <boost/exception/errinfo_api_function.hpp>
|
#include <boost/exception/errinfo_api_function.hpp>
|
||||||
@ -115,7 +114,7 @@ void Application::Exit(int rc)
|
|||||||
std::cout.flush();
|
std::cout.flush();
|
||||||
std::cerr.flush();
|
std::cerr.flush();
|
||||||
|
|
||||||
BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) {
|
for (const Logger::Ptr& logger : Logger::GetLoggers()) {
|
||||||
logger->Flush();
|
logger->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +451,7 @@ String Application::GetExePath(const String& argv0)
|
|||||||
boost::algorithm::split(paths, pathEnv, boost::is_any_of(":"));
|
boost::algorithm::split(paths, pathEnv, boost::is_any_of(":"));
|
||||||
|
|
||||||
bool foundPath = false;
|
bool foundPath = false;
|
||||||
BOOST_FOREACH(String& path, paths) {
|
for (const String& path : paths) {
|
||||||
String pathTest = path + "/" + argv0;
|
String pathTest = path + "/" + argv0;
|
||||||
|
|
||||||
if (access(pathTest.CStr(), X_OK) == 0) {
|
if (access(pathTest.CStr(), X_OK) == 0) {
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/scriptframe.hpp"
|
#include "base/scriptframe.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -123,7 +122,7 @@ static Value ArrayJoin(const Value& separator)
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
BOOST_FOREACH(const Value& item, self) {
|
for (const Value& item : self) {
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
@ -154,7 +153,7 @@ static Array::Ptr ArrayMap(const Function::Ptr& function)
|
|||||||
Array::Ptr result = new Array();
|
Array::Ptr result = new Array();
|
||||||
|
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
BOOST_FOREACH(const Value& item, self) {
|
for (const Value& item : self) {
|
||||||
std::vector<Value> args;
|
std::vector<Value> args;
|
||||||
args.push_back(item);
|
args.push_back(item);
|
||||||
result->Add(function->Invoke(args));
|
result->Add(function->Invoke(args));
|
||||||
@ -198,7 +197,7 @@ static Array::Ptr ArrayFilter(const Function::Ptr& function)
|
|||||||
Array::Ptr result = new Array();
|
Array::Ptr result = new Array();
|
||||||
|
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
BOOST_FOREACH(const Value& item, self) {
|
for (const Value& item : self) {
|
||||||
std::vector<Value> args;
|
std::vector<Value> args;
|
||||||
args.push_back(item);
|
args.push_back(item);
|
||||||
if (function->Invoke(args))
|
if (function->Invoke(args))
|
||||||
@ -216,7 +215,7 @@ static Array::Ptr ArrayUnique(void)
|
|||||||
std::set<Value> result;
|
std::set<Value> result;
|
||||||
|
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
BOOST_FOREACH(const Value& item, self) {
|
for (const Value& item : self) {
|
||||||
result.insert(item);
|
result.insert(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "base/configwriter.hpp"
|
#include "base/configwriter.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -185,7 +184,7 @@ Object::Ptr Array::Clone(void) const
|
|||||||
Array::Ptr arr = new Array();
|
Array::Ptr arr = new Array();
|
||||||
|
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
BOOST_FOREACH(const Value& val, m_Data) {
|
for (const Value& val : m_Data) {
|
||||||
arr->Add(val.Clone());
|
arr->Add(val.Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,33 +142,16 @@ private:
|
|||||||
std::vector<Value> m_Data; /**< The data for the array. */
|
std::vector<Value> m_Data; /**< The data for the array. */
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Array::Iterator range_begin(Array::Ptr x)
|
inline Array::Iterator begin(Array::Ptr x)
|
||||||
{
|
{
|
||||||
return x->Begin();
|
return x->Begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Array::Iterator range_end(Array::Ptr x)
|
inline Array::Iterator end(Array::Ptr x)
|
||||||
{
|
{
|
||||||
return x->End();
|
return x->End();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace boost
|
|
||||||
{
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct range_mutable_iterator<icinga::Array::Ptr>
|
|
||||||
{
|
|
||||||
typedef icinga::Array::Iterator type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct range_const_iterator<icinga::Array::Ptr>
|
|
||||||
{
|
|
||||||
typedef icinga::Array::Iterator type;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ARRAY_H */
|
#endif /* ARRAY_H */
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/exception/errinfo_api_function.hpp>
|
#include <boost/exception/errinfo_api_function.hpp>
|
||||||
@ -181,7 +180,7 @@ void ConfigObject::ModifyAttribute(const String& attr, const Value& value, bool
|
|||||||
if (oldValue.IsObjectType<Dictionary>()) {
|
if (oldValue.IsObjectType<Dictionary>()) {
|
||||||
Dictionary::Ptr oldDict = oldValue;
|
Dictionary::Ptr oldDict = oldValue;
|
||||||
ObjectLock olock(oldDict);
|
ObjectLock olock(oldDict);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, oldDict) {
|
for (const auto& kv : oldDict) {
|
||||||
String key = prefix + "." + kv.first;
|
String key = prefix + "." + kv.first;
|
||||||
if (!original_attributes->Contains(key))
|
if (!original_attributes->Contains(key))
|
||||||
original_attributes->Set(key, kv.second);
|
original_attributes->Set(key, kv.second);
|
||||||
@ -191,7 +190,7 @@ void ConfigObject::ModifyAttribute(const String& attr, const Value& value, bool
|
|||||||
if (value.IsObjectType<Dictionary>()) {
|
if (value.IsObjectType<Dictionary>()) {
|
||||||
Dictionary::Ptr valueDict = value;
|
Dictionary::Ptr valueDict = value;
|
||||||
ObjectLock olock(valueDict);
|
ObjectLock olock(valueDict);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, valueDict) {
|
for (const auto& kv : valueDict) {
|
||||||
String key = attr + "." + kv.first;
|
String key = attr + "." + kv.first;
|
||||||
if (!original_attributes->Contains(key))
|
if (!original_attributes->Contains(key))
|
||||||
original_attributes->Set(key, Empty);
|
original_attributes->Set(key, Empty);
|
||||||
@ -282,7 +281,7 @@ void ConfigObject::RestoreAttribute(const String& attr, bool updateVersion)
|
|||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(original_attributes);
|
ObjectLock olock(original_attributes);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, original_attributes) {
|
for (const auto& kv : original_attributes) {
|
||||||
std::vector<String> originalTokens;
|
std::vector<String> originalTokens;
|
||||||
boost::algorithm::split(originalTokens, kv.first, boost::is_any_of("."));
|
boost::algorithm::split(originalTokens, kv.first, boost::is_any_of("."));
|
||||||
|
|
||||||
@ -325,7 +324,7 @@ void ConfigObject::RestoreAttribute(const String& attr, bool updateVersion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const String& attr, restoredAttrs)
|
for (const String& attr : restoredAttrs)
|
||||||
original_attributes->Remove(attr);
|
original_attributes->Remove(attr);
|
||||||
|
|
||||||
|
|
||||||
@ -497,13 +496,13 @@ void ConfigObject::DumpObjects(const String& filename, int attributeTypes)
|
|||||||
|
|
||||||
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
||||||
|
|
||||||
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
|
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
||||||
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
|
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
|
||||||
Dictionary::Ptr persistentObject = new Dictionary();
|
Dictionary::Ptr persistentObject = new Dictionary();
|
||||||
|
|
||||||
persistentObject->Set("type", type->GetName());
|
persistentObject->Set("type", type->GetName());
|
||||||
@ -599,13 +598,13 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
|
|||||||
|
|
||||||
unsigned long no_state = 0;
|
unsigned long no_state = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
|
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
||||||
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
|
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
|
||||||
if (!object->GetStateLoaded()) {
|
if (!object->GetStateLoaded()) {
|
||||||
object->OnStateLoaded();
|
object->OnStateLoaded();
|
||||||
object->SetStateLoaded(true);
|
object->SetStateLoaded(true);
|
||||||
@ -621,13 +620,13 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
|
|||||||
|
|
||||||
void ConfigObject::StopObjects(void)
|
void ConfigObject::StopObjects(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
|
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
||||||
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
|
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
|
||||||
object->Deactivate();
|
object->Deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -635,20 +634,20 @@ void ConfigObject::StopObjects(void)
|
|||||||
|
|
||||||
void ConfigObject::DumpModifiedAttributes(const boost::function<void(const ConfigObject::Ptr&, const String&, const Value&)>& callback)
|
void ConfigObject::DumpModifiedAttributes(const boost::function<void(const ConfigObject::Ptr&, const String&, const Value&)>& callback)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
|
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
||||||
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
|
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
|
||||||
Dictionary::Ptr originalAttributes = object->GetOriginalAttributes();
|
Dictionary::Ptr originalAttributes = object->GetOriginalAttributes();
|
||||||
|
|
||||||
if (!originalAttributes)
|
if (!originalAttributes)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ObjectLock olock(originalAttributes);
|
ObjectLock olock(originalAttributes);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, originalAttributes) {
|
for (const Dictionary::Pair& kv : originalAttributes) {
|
||||||
String key = kv.first;
|
String key = kv.first;
|
||||||
|
|
||||||
Type::Ptr type = object->GetReflectionType();
|
Type::Ptr type = object->GetReflectionType();
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "base/object.hpp"
|
#include "base/object.hpp"
|
||||||
#include "base/type.hpp"
|
#include "base/type.hpp"
|
||||||
#include "base/dictionary.hpp"
|
#include "base/dictionary.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
@ -55,7 +54,7 @@ public:
|
|||||||
{
|
{
|
||||||
std::vector<intrusive_ptr<ConfigObject> > objects = GetObjectsHelper(T::TypeInstance.get());
|
std::vector<intrusive_ptr<ConfigObject> > objects = GetObjectsHelper(T::TypeInstance.get());
|
||||||
std::vector<intrusive_ptr<T> > result;
|
std::vector<intrusive_ptr<T> > result;
|
||||||
BOOST_FOREACH(const intrusive_ptr<ConfigObject>& object, objects) {
|
for (const auto& object : objects) {
|
||||||
result.push_back(static_pointer_cast<T>(object));
|
result.push_back(static_pointer_cast<T>(object));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "base/configwriter.hpp"
|
#include "base/configwriter.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
@ -63,7 +62,7 @@ void ConfigWriter::EmitArrayItems(std::ostream& fp, int indentLevel, const Array
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
ObjectLock olock(val);
|
ObjectLock olock(val);
|
||||||
BOOST_FOREACH(const Value& item, val) {
|
for (const Value& item : val) {
|
||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
else
|
else
|
||||||
@ -80,7 +79,7 @@ void ConfigWriter::EmitScope(std::ostream& fp, int indentLevel, const Dictionary
|
|||||||
|
|
||||||
if (imports && imports->GetLength() > 0) {
|
if (imports && imports->GetLength() > 0) {
|
||||||
ObjectLock xlock(imports);
|
ObjectLock xlock(imports);
|
||||||
BOOST_FOREACH(const Value& import, imports) {
|
for (const Value& import : imports) {
|
||||||
fp << "\n";
|
fp << "\n";
|
||||||
EmitIndent(fp, indentLevel);
|
EmitIndent(fp, indentLevel);
|
||||||
fp << "import \"" << import << "\"";
|
fp << "import \"" << import << "\"";
|
||||||
@ -91,7 +90,7 @@ void ConfigWriter::EmitScope(std::ostream& fp, int indentLevel, const Dictionary
|
|||||||
|
|
||||||
if (val) {
|
if (val) {
|
||||||
ObjectLock olock(val);
|
ObjectLock olock(val);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, val) {
|
for (const Dictionary::Pair& kv : val) {
|
||||||
fp << "\n";
|
fp << "\n";
|
||||||
EmitIndent(fp, indentLevel);
|
EmitIndent(fp, indentLevel);
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include <boost/thread/tss.hpp>
|
#include <boost/thread/tss.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -52,7 +51,7 @@ void ContextTrace::Print(std::ostream& fp) const
|
|||||||
fp << std::endl;
|
fp << std::endl;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
BOOST_FOREACH(const String& frame, m_Frames) {
|
for (const String& frame : m_Frames) {
|
||||||
fp << "\t(" << i << ") " << frame << std::endl;
|
fp << "\t(" << i << ") " << frame << std::endl;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/dependencygraph.hpp"
|
#include "base/dependencygraph.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ std::vector<Object::Ptr> DependencyGraph::GetParents(const Object::Ptr& child)
|
|||||||
|
|
||||||
if (it != m_Dependencies.end()) {
|
if (it != m_Dependencies.end()) {
|
||||||
typedef std::pair<Object *, int> kv_pair;
|
typedef std::pair<Object *, int> kv_pair;
|
||||||
BOOST_FOREACH(const kv_pair& kv, it->second) {
|
for (const kv_pair& kv : it->second) {
|
||||||
objects.push_back(kv.first);
|
objects.push_back(kv.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "base/functionwrapper.hpp"
|
#include "base/functionwrapper.hpp"
|
||||||
#include "base/scriptframe.hpp"
|
#include "base/scriptframe.hpp"
|
||||||
#include "base/array.hpp"
|
#include "base/array.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -74,7 +73,7 @@ static Array::Ptr DictionaryKeys(void)
|
|||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
Array::Ptr keys = new Array();
|
Array::Ptr keys = new Array();
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, self) {
|
for (const Dictionary::Pair& kv : self) {
|
||||||
keys->Add(kv.first);
|
keys->Add(kv.first);
|
||||||
}
|
}
|
||||||
return keys;
|
return keys;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "base/debug.hpp"
|
#include "base/debug.hpp"
|
||||||
#include "base/primitivetype.hpp"
|
#include "base/primitivetype.hpp"
|
||||||
#include "base/configwriter.hpp"
|
#include "base/configwriter.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -137,7 +136,7 @@ void Dictionary::CopyTo(const Dictionary::Ptr& dest) const
|
|||||||
{
|
{
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
|
for (const Dictionary::Pair& kv : m_Data) {
|
||||||
dest->Set(kv.first, kv.second);
|
dest->Set(kv.first, kv.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +164,7 @@ Object::Ptr Dictionary::Clone(void) const
|
|||||||
Dictionary::Ptr dict = new Dictionary();
|
Dictionary::Ptr dict = new Dictionary();
|
||||||
|
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
|
for (const Dictionary::Pair& kv : m_Data) {
|
||||||
dict->Set(kv.first, kv.second.Clone());
|
dict->Set(kv.first, kv.second.Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +183,7 @@ std::vector<String> Dictionary::GetKeys(void) const
|
|||||||
|
|
||||||
std::vector<String> keys;
|
std::vector<String> keys;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, m_Data) {
|
for (const Dictionary::Pair& kv : m_Data) {
|
||||||
keys.push_back(kv.first);
|
keys.push_back(kv.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,33 +125,16 @@ private:
|
|||||||
std::map<String, Value> m_Data; /**< The data for the dictionary. */
|
std::map<String, Value> m_Data; /**< The data for the dictionary. */
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Dictionary::Iterator range_begin(Dictionary::Ptr x)
|
inline Dictionary::Iterator begin(Dictionary::Ptr x)
|
||||||
{
|
{
|
||||||
return x->Begin();
|
return x->Begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Dictionary::Iterator range_end(Dictionary::Ptr x)
|
inline Dictionary::Iterator end(Dictionary::Ptr x)
|
||||||
{
|
{
|
||||||
return x->End();
|
return x->End();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace boost
|
|
||||||
{
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct range_mutable_iterator<icinga::Dictionary::Ptr>
|
|
||||||
{
|
|
||||||
typedef icinga::Dictionary::Iterator type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct range_const_iterator<icinga::Dictionary::Ptr>
|
|
||||||
{
|
|
||||||
typedef icinga::Dictionary::Iterator type;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* DICTIONARY_H */
|
#endif /* DICTIONARY_H */
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/thread/tss.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
#ifdef HAVE_CXXABI_H
|
#ifdef HAVE_CXXABI_H
|
||||||
# include <cxxabi.h>
|
# include <cxxabi.h>
|
||||||
@ -160,7 +158,7 @@ String icinga::DiagnosticInformation(const std::exception& ex, bool verbose, Sta
|
|||||||
Array::Ptr messages;
|
Array::Ptr messages;
|
||||||
|
|
||||||
if (currentHint) {
|
if (currentHint) {
|
||||||
BOOST_FOREACH(const String& attr, vex->GetAttributePath()) {
|
for (const String& attr : vex->GetAttributePath()) {
|
||||||
Dictionary::Ptr props = currentHint->Get("properties");
|
Dictionary::Ptr props = currentHint->Get("properties");
|
||||||
|
|
||||||
if (!props)
|
if (!props)
|
||||||
@ -326,7 +324,7 @@ ValidationError::ValidationError(const ConfigObject::Ptr& object, const std::vec
|
|||||||
{
|
{
|
||||||
String path;
|
String path;
|
||||||
|
|
||||||
BOOST_FOREACH(const String& attribute, attributePath) {
|
for (const String& attribute : attributePath) {
|
||||||
if (!path.IsEmpty())
|
if (!path.IsEmpty())
|
||||||
path += " -> ";
|
path += " -> ";
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ void FileLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const FileLogger::Ptr& filelogger, ConfigType::GetObjectsByType<FileLogger>()) {
|
for (const FileLogger::Ptr& filelogger : ConfigType::GetObjectsByType<FileLogger>()) {
|
||||||
nodes->Set(filelogger->GetName(), 1); //add more stats
|
nodes->Set(filelogger->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/array.hpp"
|
#include "base/array.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/exception_ptr.hpp>
|
#include <boost/exception_ptr.hpp>
|
||||||
#include <yajl/yajl_version.h>
|
#include <yajl/yajl_version.h>
|
||||||
#include <yajl/yajl_gen.h>
|
#include <yajl/yajl_gen.h>
|
||||||
@ -45,7 +44,7 @@ static void EncodeDictionary(yajl_gen handle, const Dictionary::Ptr& dict)
|
|||||||
yajl_gen_map_open(handle);
|
yajl_gen_map_open(handle);
|
||||||
|
|
||||||
ObjectLock olock(dict);
|
ObjectLock olock(dict);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
|
for (const Dictionary::Pair& kv : dict) {
|
||||||
yajl_gen_string(handle, reinterpret_cast<const unsigned char *>(kv.first.CStr()), kv.first.GetLength());
|
yajl_gen_string(handle, reinterpret_cast<const unsigned char *>(kv.first.CStr()), kv.first.GetLength());
|
||||||
Encode(handle, kv.second);
|
Encode(handle, kv.second);
|
||||||
}
|
}
|
||||||
@ -58,7 +57,7 @@ static void EncodeArray(yajl_gen handle, const Array::Ptr& arr)
|
|||||||
yajl_gen_array_open(handle);
|
yajl_gen_array_open(handle);
|
||||||
|
|
||||||
ObjectLock olock(arr);
|
ObjectLock olock(arr);
|
||||||
BOOST_FOREACH(const Value& value, arr) {
|
for (const Value& value : arr) {
|
||||||
Encode(handle, value);
|
Encode(handle, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "base/loader.hpp"
|
#include "base/loader.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -102,7 +101,7 @@ void icinga::IcingaLog(LogSeverity severity, const String& facility,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) {
|
for (const Logger::Ptr& logger : Logger::GetLoggers()) {
|
||||||
ObjectLock llock(logger);
|
ObjectLock llock(logger);
|
||||||
|
|
||||||
if (!logger->IsActive())
|
if (!logger->IsActive())
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include <boost/math/special_functions/round.hpp>
|
#include <boost/math/special_functions/round.hpp>
|
||||||
#include <boost/math/special_functions/fpclassify.hpp>
|
#include <boost/math/special_functions/fpclassify.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -84,7 +83,7 @@ static Value MathMax(const std::vector<Value>& args)
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
Value result = -INFINITY;
|
Value result = -INFINITY;
|
||||||
|
|
||||||
BOOST_FOREACH(const Value& arg, args) {
|
for (const Value& arg : args) {
|
||||||
if (first || arg > result) {
|
if (first || arg > result) {
|
||||||
first = false;
|
first = false;
|
||||||
result = arg;
|
result = arg;
|
||||||
@ -99,7 +98,7 @@ static Value MathMin(const std::vector<Value>& args)
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
Value result = INFINITY;
|
Value result = INFINITY;
|
||||||
|
|
||||||
BOOST_FOREACH(const Value& arg, args) {
|
for (const Value& arg : args) {
|
||||||
if (first || arg < result) {
|
if (first || arg < result) {
|
||||||
first = false;
|
first = false;
|
||||||
result = arg;
|
result = arg;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "base/timer.hpp"
|
#include "base/timer.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -227,7 +226,7 @@ static void TypeInfoTimerHandler(void)
|
|||||||
boost::mutex::scoped_lock lock(l_ObjectCountLock);
|
boost::mutex::scoped_lock lock(l_ObjectCountLock);
|
||||||
|
|
||||||
typedef std::map<String, int>::value_type kv_pair;
|
typedef std::map<String, int>::value_type kv_pair;
|
||||||
BOOST_FOREACH(kv_pair& kv, l_ObjectCounts) {
|
for (kv_pair& kv : l_ObjectCounts) {
|
||||||
if (kv.second == 0)
|
if (kv.second == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
|
|
||||||
@ -128,7 +127,7 @@ Process::Arguments Process::PrepareCommand(const Value& command)
|
|||||||
Array::Ptr arguments = command;
|
Array::Ptr arguments = command;
|
||||||
|
|
||||||
ObjectLock olock(arguments);
|
ObjectLock olock(arguments);
|
||||||
BOOST_FOREACH(const Value& argument, arguments) {
|
for (const Value& argument : arguments) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (args != "")
|
if (args != "")
|
||||||
args += " ";
|
args += " ";
|
||||||
@ -200,7 +199,7 @@ void Process::IOThreadProc(int tid)
|
|||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
typedef std::pair<ProcessHandle, Process::Ptr> kv_pair;
|
typedef std::pair<ProcessHandle, Process::Ptr> kv_pair;
|
||||||
BOOST_FOREACH(const kv_pair& kv, l_Processes[tid]) {
|
for (const kv_pair& kv : l_Processes[tid]) {
|
||||||
const Process::Ptr& process = kv.second;
|
const Process::Ptr& process = kv.second;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
handles[i] = kv.first;
|
handles[i] = kv.first;
|
||||||
@ -454,7 +453,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
|
|||||||
if (m_ExtraEnvironment) {
|
if (m_ExtraEnvironment) {
|
||||||
ObjectLock olock(m_ExtraEnvironment);
|
ObjectLock olock(m_ExtraEnvironment);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, m_ExtraEnvironment) {
|
for (const Dictionary::Pair& kv : m_ExtraEnvironment) {
|
||||||
String skv = kv.first + "=" + Convert::ToString(kv.second);
|
String skv = kv.first + "=" + Convert::ToString(kv.second);
|
||||||
|
|
||||||
envp = static_cast<char *>(realloc(envp, offset + skv.GetLength() + 1));
|
envp = static_cast<char *>(realloc(envp, offset + skv.GetLength() + 1));
|
||||||
@ -560,7 +559,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
|
|||||||
ObjectLock olock(m_ExtraEnvironment);
|
ObjectLock olock(m_ExtraEnvironment);
|
||||||
|
|
||||||
int index = envc;
|
int index = envc;
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, m_ExtraEnvironment) {
|
for (const Dictionary::Pair& kv : m_ExtraEnvironment) {
|
||||||
String skv = kv.first + "=" + Convert::ToString(kv.second);
|
String skv = kv.first + "=" + Convert::ToString(kv.second);
|
||||||
envp[index] = strdup(skv.CStr());
|
envp[index] = strdup(skv.CStr());
|
||||||
index++;
|
index++;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/signals2.hpp>
|
#include <boost/signals2.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
@ -80,9 +79,7 @@ public:
|
|||||||
items = m_Items;
|
items = m_Items;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef typename std::pair<String, T> ItemMapPair;
|
for (const auto& kv : items) {
|
||||||
|
|
||||||
BOOST_FOREACH(const ItemMapPair& kv, items) {
|
|
||||||
OnUnregistered(kv.first);
|
OnUnregistered(kv.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
@ -105,7 +104,7 @@ void ScriptGlobal::WriteToFile(const String& filename)
|
|||||||
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
||||||
|
|
||||||
ObjectLock olock(m_Globals);
|
ObjectLock olock(m_Globals);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, m_Globals) {
|
for (const Dictionary::Pair& kv : m_Globals) {
|
||||||
Dictionary::Ptr persistentVariable = new Dictionary();
|
Dictionary::Ptr persistentVariable = new Dictionary();
|
||||||
|
|
||||||
persistentVariable->Set("name", kv.first);
|
persistentVariable->Set("name", kv.first);
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "base/configtype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/dependencygraph.hpp"
|
#include "base/dependencygraph.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -115,19 +114,19 @@ Array::Ptr ScriptUtils::Union(const std::vector<Value>& arguments)
|
|||||||
{
|
{
|
||||||
std::set<Value> values;
|
std::set<Value> values;
|
||||||
|
|
||||||
BOOST_FOREACH(const Value& varr, arguments) {
|
for (const Value& varr : arguments) {
|
||||||
Array::Ptr arr = varr;
|
Array::Ptr arr = varr;
|
||||||
|
|
||||||
if (arr) {
|
if (arr) {
|
||||||
ObjectLock olock(arr);
|
ObjectLock olock(arr);
|
||||||
BOOST_FOREACH(const Value& value, arr) {
|
for (const Value& value : arr) {
|
||||||
values.insert(value);
|
values.insert(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Array::Ptr result = new Array();
|
Array::Ptr result = new Array();
|
||||||
BOOST_FOREACH(const Value& value, values) {
|
for (const Value& value : values) {
|
||||||
result->Add(value);
|
result->Add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +251,7 @@ Array::Ptr ScriptUtils::Keys(const Dictionary::Ptr& dict)
|
|||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
ObjectLock olock(dict);
|
ObjectLock olock(dict);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
|
for (const Dictionary::Pair& kv : dict) {
|
||||||
result->Add(kv.first);
|
result->Add(kv.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,7 +288,7 @@ Array::Ptr ScriptUtils::GetObjects(const Type::Ptr& type)
|
|||||||
|
|
||||||
Array::Ptr result = new Array();
|
Array::Ptr result = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigObject::Ptr& object, ctype->GetObjects())
|
for (const ConfigObject::Ptr& object : ctype->GetObjects())
|
||||||
result->Add(object);
|
result->Add(object);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "base/type.hpp"
|
#include "base/type.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ static Array::Ptr SerializeArray(const Array::Ptr& input, int attributeTypes)
|
|||||||
|
|
||||||
ObjectLock olock(input);
|
ObjectLock olock(input);
|
||||||
|
|
||||||
BOOST_FOREACH(const Value& value, input) {
|
for (const Value& value : input) {
|
||||||
result->Add(Serialize(value, attributeTypes));
|
result->Add(Serialize(value, attributeTypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ static Dictionary::Ptr SerializeDictionary(const Dictionary::Ptr& input, int att
|
|||||||
|
|
||||||
ObjectLock olock(input);
|
ObjectLock olock(input);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, input) {
|
for (const Dictionary::Pair& kv : input) {
|
||||||
result->Set(kv.first, Serialize(kv.second, attributeTypes));
|
result->Set(kv.first, Serialize(kv.second, attributeTypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ static Array::Ptr DeserializeArray(const Array::Ptr& input, bool safe_mode, int
|
|||||||
|
|
||||||
ObjectLock olock(input);
|
ObjectLock olock(input);
|
||||||
|
|
||||||
BOOST_FOREACH(const Value& value, input) {
|
for (const Value& value : input) {
|
||||||
result->Add(Deserialize(value, safe_mode, attributeTypes));
|
result->Add(Deserialize(value, safe_mode, attributeTypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ static Dictionary::Ptr DeserializeDictionary(const Dictionary::Ptr& input, bool
|
|||||||
|
|
||||||
ObjectLock olock(input);
|
ObjectLock olock(input);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, input) {
|
for (const Dictionary::Pair& kv : input) {
|
||||||
result->Set(kv.first, Deserialize(kv.second, safe_mode, attributeTypes));
|
result->Set(kv.first, Deserialize(kv.second, safe_mode, attributeTypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +122,7 @@ static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary
|
|||||||
instance = type->Instantiate(std::vector<Value>());
|
instance = type->Instantiate(std::vector<Value>());
|
||||||
|
|
||||||
ObjectLock olock(input);
|
ObjectLock olock(input);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, input) {
|
for (const Dictionary::Pair& kv : input) {
|
||||||
if (kv.first.IsEmpty())
|
if (kv.first.IsEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# include <sys/epoll.h>
|
# include <sys/epoll.h>
|
||||||
@ -121,7 +120,7 @@ void SocketEventEngineEpoll::ThreadProc(int tid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const EventDescription& event, events) {
|
for (const EventDescription& event : events) {
|
||||||
try {
|
try {
|
||||||
event.Descriptor.EventInterface->OnEvent(event.REvents);
|
event.Descriptor.EventInterface->OnEvent(event.REvents);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -54,7 +53,7 @@ void SocketEventEnginePoll::ThreadProc(int tid)
|
|||||||
|
|
||||||
typedef std::map<SOCKET, SocketEventDescriptor>::value_type kv_pair;
|
typedef std::map<SOCKET, SocketEventDescriptor>::value_type kv_pair;
|
||||||
|
|
||||||
BOOST_FOREACH(const kv_pair& desc, m_Sockets[tid]) {
|
for (const kv_pair& desc : m_Sockets[tid]) {
|
||||||
if (desc.second.Events == 0)
|
if (desc.second.Events == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -113,7 +112,7 @@ void SocketEventEnginePoll::ThreadProc(int tid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const EventDescription& event, events) {
|
for (const EventDescription& event : events) {
|
||||||
try {
|
try {
|
||||||
event.Descriptor.EventInterface->OnEvent(event.REvents);
|
event.Descriptor.EventInterface->OnEvent(event.REvents);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# include <sys/epoll.h>
|
# include <sys/epoll.h>
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "base/scriptframe.hpp"
|
#include "base/scriptframe.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ static Array::Ptr StringSplit(const String& delims)
|
|||||||
boost::algorithm::split(tokens, self, boost::is_any_of(delims));
|
boost::algorithm::split(tokens, self, boost::is_any_of(delims));
|
||||||
|
|
||||||
Array::Ptr result = new Array();
|
Array::Ptr result = new Array();
|
||||||
BOOST_FOREACH(const String& token, tokens) {
|
for (const String& token : tokens) {
|
||||||
result->Add(token);
|
result->Add(token);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -439,6 +439,25 @@ inline bool operator!=(const char *lhs, const String& rhs)
|
|||||||
return lhs != rhs.GetData();
|
return lhs != rhs.GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline String::Iterator begin(String& x)
|
||||||
|
{
|
||||||
|
return x.Begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline String::ConstIterator begin(const String& x)
|
||||||
|
{
|
||||||
|
return x.Begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline String::Iterator end(String& x)
|
||||||
|
{
|
||||||
|
return x.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline String::ConstIterator end(const String& x)
|
||||||
|
{
|
||||||
|
return x.End();
|
||||||
|
}
|
||||||
inline String::Iterator range_begin(String& x)
|
inline String::Iterator range_begin(String& x)
|
||||||
{
|
{
|
||||||
return x.Begin();
|
return x.Begin();
|
||||||
|
@ -34,7 +34,7 @@ void SyslogLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const SyslogLogger::Ptr& sysloglogger, ConfigType::GetObjectsByType<SyslogLogger>()) {
|
for (const SyslogLogger::Ptr& sysloglogger : ConfigType::GetObjectsByType<SyslogLogger>()) {
|
||||||
nodes->Set(sysloglogger->GetName(), 1); //add more stats
|
nodes->Set(sysloglogger->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "base/debug.hpp"
|
#include "base/debug.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/thread/condition_variable.hpp>
|
#include <boost/thread/condition_variable.hpp>
|
||||||
@ -223,7 +222,7 @@ void Timer::AdjustTimers(double adjustment)
|
|||||||
|
|
||||||
std::vector<Timer *> timers;
|
std::vector<Timer *> timers;
|
||||||
|
|
||||||
BOOST_FOREACH(Timer *timer, idx) {
|
for (Timer *timer : idx) {
|
||||||
if (std::fabs(now - (timer->m_Next + adjustment)) <
|
if (std::fabs(now - (timer->m_Next + adjustment)) <
|
||||||
std::fabs(now - timer->m_Next)) {
|
std::fabs(now - timer->m_Next)) {
|
||||||
timer->m_Next += adjustment;
|
timer->m_Next += adjustment;
|
||||||
@ -231,7 +230,7 @@ void Timer::AdjustTimers(double adjustment)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(Timer *timer, timers) {
|
for (Timer *timer : timers) {
|
||||||
l_Timers.erase(timer);
|
l_Timers.erase(timer);
|
||||||
l_Timers.insert(timer);
|
l_Timers.insert(timer);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "base/type.hpp"
|
#include "base/type.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -72,11 +71,10 @@ std::vector<Type::Ptr> Type::GetAllTypes(void)
|
|||||||
if (typesNS) {
|
if (typesNS) {
|
||||||
ObjectLock olock(typesNS);
|
ObjectLock olock(typesNS);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, typesNS) {
|
for (const Dictionary::Pair& kv : typesNS) {
|
||||||
if (kv.second.IsObjectType<Type>())
|
if (kv.second.IsObjectType<Type>())
|
||||||
types.push_back(kv.second);
|
types.push_back(kv.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <mmatch.h>
|
#include <mmatch.h>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/trim.hpp>
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
@ -264,7 +263,7 @@ String Utility::DirName(const String& path)
|
|||||||
String dupPath = path;
|
String dupPath = path;
|
||||||
|
|
||||||
/* PathRemoveFileSpec doesn't properly handle forward slashes. */
|
/* PathRemoveFileSpec doesn't properly handle forward slashes. */
|
||||||
BOOST_FOREACH(char& ch, dupPath) {
|
for (char& ch : dupPath) {
|
||||||
if (ch == '/')
|
if (ch == '/')
|
||||||
ch = '\\';
|
ch = '\\';
|
||||||
}
|
}
|
||||||
@ -543,7 +542,7 @@ bool Utility::Glob(const String& pathSpec, const boost::function<void (const Str
|
|||||||
if (!GlobHelper(part1, GlobDirectory, files2, dirs2))
|
if (!GlobHelper(part1, GlobDirectory, files2, dirs2))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BOOST_FOREACH(const String& dir, dirs2) {
|
for (const String& dir : dirs2) {
|
||||||
if (!Utility::Glob(dir + "/" + part2, callback, type))
|
if (!Utility::Glob(dir + "/" + part2, callback, type))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -595,12 +594,12 @@ bool Utility::Glob(const String& pathSpec, const boost::function<void (const Str
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
std::sort(files.begin(), files.end());
|
std::sort(files.begin(), files.end());
|
||||||
BOOST_FOREACH(const String& cpath, files) {
|
for (const String& cpath : files) {
|
||||||
callback(cpath);
|
callback(cpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(dirs.begin(), dirs.end());
|
std::sort(dirs.begin(), dirs.end());
|
||||||
BOOST_FOREACH(const String& cpath, dirs) {
|
for (const String& cpath : dirs) {
|
||||||
callback(cpath);
|
callback(cpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,17 +720,17 @@ bool Utility::GlobRecursive(const String& path, const String& pattern, const boo
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
std::sort(files.begin(), files.end());
|
std::sort(files.begin(), files.end());
|
||||||
BOOST_FOREACH(const String& cpath, files) {
|
for (const String& cpath : files) {
|
||||||
callback(cpath);
|
callback(cpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(dirs.begin(), dirs.end());
|
std::sort(dirs.begin(), dirs.end());
|
||||||
BOOST_FOREACH(const String& cpath, dirs) {
|
for (const String& cpath : dirs) {
|
||||||
callback(cpath);
|
callback(cpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(alldirs.begin(), alldirs.end());
|
std::sort(alldirs.begin(), alldirs.end());
|
||||||
BOOST_FOREACH(const String& cpath, alldirs) {
|
for (const String& cpath : alldirs) {
|
||||||
GlobRecursive(cpath, pattern, callback, type);
|
GlobRecursive(cpath, pattern, callback, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,7 +781,7 @@ void Utility::RemoveDirRecursive(const String& path)
|
|||||||
first before recursing into subdirectories. */
|
first before recursing into subdirectories. */
|
||||||
std::reverse(paths.begin(), paths.end());
|
std::reverse(paths.begin(), paths.end());
|
||||||
|
|
||||||
BOOST_FOREACH(const String& path, paths) {
|
for (const String& path : paths) {
|
||||||
if (remove(path.CStr()) < 0)
|
if (remove(path.CStr()) < 0)
|
||||||
BOOST_THROW_EXCEPTION(posix_error()
|
BOOST_THROW_EXCEPTION(posix_error()
|
||||||
<< boost::errinfo_api_function("remove")
|
<< boost::errinfo_api_function("remove")
|
||||||
@ -945,7 +944,7 @@ String Utility::Join(const Array::Ptr& tokens, char separator, bool escapeSepara
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
ObjectLock olock(tokens);
|
ObjectLock olock(tokens);
|
||||||
BOOST_FOREACH(const Value& vtoken, tokens) {
|
for (const Value& vtoken : tokens) {
|
||||||
String token = Convert::ToString(vtoken);
|
String token = Convert::ToString(vtoken);
|
||||||
|
|
||||||
if (escapeSeparator) {
|
if (escapeSeparator) {
|
||||||
@ -1071,7 +1070,7 @@ String Utility::EscapeShellCmd(const String& s)
|
|||||||
size_t prev_quote = String::NPos;
|
size_t prev_quote = String::NPos;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
BOOST_FOREACH(char ch, s) {
|
for (char ch : s) {
|
||||||
bool escape = false;
|
bool escape = false;
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
@ -1121,7 +1120,7 @@ String Utility::EscapeShellArg(const String& s)
|
|||||||
result = "'";
|
result = "'";
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
BOOST_FOREACH(char ch, s) {
|
for (char ch : s) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (ch == '"' || ch == '%') {
|
if (ch == '"' || ch == '%') {
|
||||||
result += ' ';
|
result += ' ';
|
||||||
@ -1236,7 +1235,7 @@ unsigned long Utility::SDBM(const String& str, size_t len)
|
|||||||
unsigned long hash = 0;
|
unsigned long hash = 0;
|
||||||
size_t current = 0;
|
size_t current = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(char c, str) {
|
for (char c : str) {
|
||||||
if (current >= len)
|
if (current >= len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1424,7 +1423,7 @@ String Utility::EscapeString(const String& s, const String& chars, const bool il
|
|||||||
{
|
{
|
||||||
std::ostringstream result;
|
std::ostringstream result;
|
||||||
if (illegal) {
|
if (illegal) {
|
||||||
BOOST_FOREACH(char ch, s) {
|
for (char ch : s) {
|
||||||
if (chars.FindFirstOf(ch) != String::NPos || ch == '%') {
|
if (chars.FindFirstOf(ch) != String::NPos || ch == '%') {
|
||||||
result << '%';
|
result << '%';
|
||||||
HexEncode(ch, result);
|
HexEncode(ch, result);
|
||||||
@ -1432,7 +1431,7 @@ String Utility::EscapeString(const String& s, const String& chars, const bool il
|
|||||||
result << ch;
|
result << ch;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BOOST_FOREACH(char ch, s) {
|
for (char ch : s) {
|
||||||
if (chars.FindFirstOf(ch) == String::NPos || ch == '%') {
|
if (chars.FindFirstOf(ch) == String::NPos || ch == '%') {
|
||||||
result << '%';
|
result << '%';
|
||||||
HexEncode(ch, result);
|
HexEncode(ch, result);
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -297,10 +296,10 @@ Value icinga::operator-(const Value& lhs, const Value& rhs)
|
|||||||
Array::Ptr right = rhs;
|
Array::Ptr right = rhs;
|
||||||
|
|
||||||
ObjectLock olock(left);
|
ObjectLock olock(left);
|
||||||
BOOST_FOREACH(const Value& lv, left) {
|
for (const Value& lv : left) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
ObjectLock xlock(right);
|
ObjectLock xlock(right);
|
||||||
BOOST_FOREACH(const Value& rv, right) {
|
for (const Value& rv : right) {
|
||||||
if (lv == rv) {
|
if (lv == rv) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/thread/tss.hpp>
|
#include <boost/thread/tss.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -173,7 +172,7 @@ void WorkQueue::ReportExceptions(const String& facility) const
|
|||||||
{
|
{
|
||||||
std::vector<boost::exception_ptr> exceptions = GetExceptions();
|
std::vector<boost::exception_ptr> exceptions = GetExceptions();
|
||||||
|
|
||||||
BOOST_FOREACH(const boost::exception_ptr& eptr, exceptions) {
|
for (const auto& eptr : exceptions) {
|
||||||
Log(LogCritical, facility)
|
Log(LogCritical, facility)
|
||||||
<< DiagnosticInformation(eptr);
|
<< DiagnosticInformation(eptr);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ void CheckerComponent::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const CheckerComponent::Ptr& checker, ConfigType::GetObjectsByType<CheckerComponent>()) {
|
for (const CheckerComponent::Ptr& checker : ConfigType::GetObjectsByType<CheckerComponent>()) {
|
||||||
unsigned long idle = checker->GetIdleCheckables();
|
unsigned long idle = checker->GetIdleCheckables();
|
||||||
unsigned long pending = checker->GetPendingCheckables();
|
unsigned long pending = checker->GetPendingCheckables();
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "base/tlsutility.hpp"
|
#include "base/tlsutility.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
#include <boost/algorithm/string/case_conv.hpp>
|
||||||
@ -141,7 +140,7 @@ bool ApiSetupUtility::SetupMasterCertificates(const String& cn)
|
|||||||
files.push_back(csr);
|
files.push_back(csr);
|
||||||
files.push_back(cert);
|
files.push_back(cert);
|
||||||
|
|
||||||
BOOST_FOREACH(const String& file, files) {
|
for (const String& file : files) {
|
||||||
if (!Utility::SetFileOwnership(file, user, group)) {
|
if (!Utility::SetFileOwnership(file, user, group)) {
|
||||||
Log(LogWarning, "cli")
|
Log(LogWarning, "cli")
|
||||||
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on file '" << file << "'.";
|
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on file '" << file << "'.";
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/serializer.hpp"
|
#include "base/serializer.hpp"
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/trim.hpp>
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -173,7 +172,7 @@ bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& vi
|
|||||||
std::vector<String> best_match;
|
std::vector<String> best_match;
|
||||||
int arg_end = 0;
|
int arg_end = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
|
for (const CLIKeyValue& kv : GetRegistry()) {
|
||||||
const std::vector<String>& vname = kv.first;
|
const std::vector<String>& vname = kv.first;
|
||||||
|
|
||||||
std::vector<String>::size_type i;
|
std::vector<String>::size_type i;
|
||||||
@ -234,7 +233,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
|
|||||||
int arg_begin = 0;
|
int arg_begin = 0;
|
||||||
CLICommand::Ptr command;
|
CLICommand::Ptr command;
|
||||||
|
|
||||||
BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
|
for (const CLIKeyValue& kv : GetRegistry()) {
|
||||||
const std::vector<String>& vname = kv.first;
|
const std::vector<String>& vname = kv.first;
|
||||||
|
|
||||||
arg_begin = 0;
|
arg_begin = 0;
|
||||||
@ -276,7 +275,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
|
|||||||
} else
|
} else
|
||||||
std::cout << "Supported commands: " << std::endl;
|
std::cout << "Supported commands: " << std::endl;
|
||||||
|
|
||||||
BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
|
for (const CLIKeyValue& kv : GetRegistry()) {
|
||||||
const std::vector<String>& vname = kv.first;
|
const std::vector<String>& vname = kv.first;
|
||||||
|
|
||||||
if (vname.size() < best_match.size() || kv.second->IsHidden())
|
if (vname.size() < best_match.size() || kv.second->IsHidden())
|
||||||
@ -345,25 +344,25 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
|
|||||||
if (odesc->semantic()->min_tokens() == 0)
|
if (odesc->semantic()->min_tokens() == 0)
|
||||||
goto complete_option;
|
goto complete_option;
|
||||||
|
|
||||||
BOOST_FOREACH(const String& suggestion, globalArgCompletionCallback(odesc->long_name(), pword)) {
|
for (const String& suggestion : globalArgCompletionCallback(odesc->long_name(), pword)) {
|
||||||
std::cout << prefix << suggestion << "\n";
|
std::cout << prefix << suggestion << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const String& suggestion, command->GetArgumentSuggestions(odesc->long_name(), pword)) {
|
for (const String& suggestion : command->GetArgumentSuggestions(odesc->long_name(), pword)) {
|
||||||
std::cout << prefix << suggestion << "\n";
|
std::cout << prefix << suggestion << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
complete_option:
|
complete_option:
|
||||||
BOOST_FOREACH(const boost::shared_ptr<po::option_description>& odesc, visibleDesc->options()) {
|
for (const boost::shared_ptr<po::option_description>& odesc : visibleDesc->options()) {
|
||||||
String cname = "--" + odesc->long_name();
|
String cname = "--" + odesc->long_name();
|
||||||
|
|
||||||
if (cname.Find(aword) == 0)
|
if (cname.Find(aword) == 0)
|
||||||
std::cout << cname << "\n";
|
std::cout << cname << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const String& suggestion, command->GetPositionalSuggestions(aword)) {
|
for (const String& suggestion : command->GetPositionalSuggestions(aword)) {
|
||||||
std::cout << suggestion << "\n";
|
std::cout << suggestion << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
|
|||||||
ConfigCompilerContext::GetInstance()->OpenObjectsFile(objectsFile);
|
ConfigCompilerContext::GetInstance()->OpenObjectsFile(objectsFile);
|
||||||
|
|
||||||
if (!configs.empty()) {
|
if (!configs.empty()) {
|
||||||
BOOST_FOREACH(const String& configPath, configs) {
|
for (const String& configPath : configs) {
|
||||||
Expression *expression = ConfigCompiler::CompileFile(configPath, String(), "_etc");
|
Expression *expression = ConfigCompiler::CompileFile(configPath, String(), "_etc");
|
||||||
success = ExecuteExpression(expression);
|
success = ExecuteExpression(expression);
|
||||||
delete expression;
|
delete expression;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -48,7 +47,7 @@ std::vector<String> FeatureUtility::GetFieldCompletionSuggestions(const String&
|
|||||||
|
|
||||||
std::sort(cache.begin(), cache.end());
|
std::sort(cache.begin(), cache.end());
|
||||||
|
|
||||||
BOOST_FOREACH(const String& suggestion, cache) {
|
for (const String& suggestion : cache) {
|
||||||
if (suggestion.Find(word) == 0)
|
if (suggestion.Find(word) == 0)
|
||||||
suggestions.push_back(suggestion);
|
suggestions.push_back(suggestion);
|
||||||
}
|
}
|
||||||
@ -75,7 +74,7 @@ int FeatureUtility::EnableFeatures(const std::vector<std::string>& features)
|
|||||||
|
|
||||||
std::vector<std::string> errors;
|
std::vector<std::string> errors;
|
||||||
|
|
||||||
BOOST_FOREACH(const String& feature, features) {
|
for (const String& feature : features) {
|
||||||
String source = features_available_dir + "/" + feature + ".conf";
|
String source = features_available_dir + "/" + feature + ".conf";
|
||||||
|
|
||||||
if (!Utility::PathExists(source) ) {
|
if (!Utility::PathExists(source) ) {
|
||||||
@ -143,7 +142,7 @@ int FeatureUtility::DisableFeatures(const std::vector<std::string>& features)
|
|||||||
|
|
||||||
std::vector<std::string> errors;
|
std::vector<std::string> errors;
|
||||||
|
|
||||||
BOOST_FOREACH(const String& feature, features) {
|
for (const String& feature : features) {
|
||||||
String target = features_enabled_dir + "/" + feature + ".conf";
|
String target = features_enabled_dir + "/" + feature + ".conf";
|
||||||
|
|
||||||
if (!Utility::PathExists(target) ) {
|
if (!Utility::PathExists(target) ) {
|
||||||
@ -242,7 +241,7 @@ bool FeatureUtility::CheckFeatureInternal(const String& feature, bool check_disa
|
|||||||
if (!FeatureUtility::GetFeatures(features, check_disabled))
|
if (!FeatureUtility::GetFeatures(features, check_disabled))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BOOST_FOREACH(const String& check_feature, features) {
|
for (const String& check_feature : features) {
|
||||||
if (check_feature == feature)
|
if (check_feature == feature)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "cli/nodeutility.hpp"
|
#include "cli/nodeutility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "cli/nodeutility.hpp"
|
#include "cli/nodeutility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -65,7 +64,7 @@ int NodeRemoveCommand::GetMaxArguments(void) const
|
|||||||
*/
|
*/
|
||||||
int NodeRemoveCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
|
int NodeRemoveCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const String& node, ap) {
|
for (const String& node : ap) {
|
||||||
NodeUtility::RemoveNode(node);
|
NodeUtility::RemoveNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "cli/nodeutility.hpp"
|
#include "cli/nodeutility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "base/tlsutility.hpp"
|
#include "base/tlsutility.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "base/tlsutility.hpp"
|
#include "base/tlsutility.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -93,7 +92,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
std::vector<Dictionary::Ptr> nodes = NodeUtility::GetNodes();
|
std::vector<Dictionary::Ptr> nodes = NodeUtility::GetNodes();
|
||||||
|
|
||||||
/* first make sure that all nodes are valid and should not be removed */
|
/* first make sure that all nodes are valid and should not be removed */
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& node, nodes) {
|
for (const Dictionary::Ptr& node : nodes) {
|
||||||
Dictionary::Ptr repository = node->Get("repository");
|
Dictionary::Ptr repository = node->Get("repository");
|
||||||
String zone = node->Get("zone");
|
String zone = node->Get("zone");
|
||||||
String endpoint = node->Get("endpoint");
|
String endpoint = node->Get("endpoint");
|
||||||
@ -106,7 +105,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
if (old_inventory) {
|
if (old_inventory) {
|
||||||
/* check if there are objects inside the old_inventory which do not exist anymore */
|
/* check if there are objects inside the old_inventory which do not exist anymore */
|
||||||
ObjectLock ulock(old_inventory);
|
ObjectLock ulock(old_inventory);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& old_node_objs, old_inventory) {
|
for (const Dictionary::Pair& old_node_objs : old_inventory) {
|
||||||
|
|
||||||
String old_node_name = old_node_objs.first;
|
String old_node_name = old_node_objs.first;
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
|
|
||||||
if (old_node_repository) {
|
if (old_node_repository) {
|
||||||
ObjectLock olock(old_node_repository);
|
ObjectLock olock(old_node_repository);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, old_node_repository) {
|
for (const Dictionary::Pair& kv : old_node_repository) {
|
||||||
String host = kv.first;
|
String host = kv.first;
|
||||||
|
|
||||||
Dictionary::Ptr host_attrs = new Dictionary();
|
Dictionary::Ptr host_attrs = new Dictionary();
|
||||||
@ -150,7 +149,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
|
|
||||||
if (old_node_repository) {
|
if (old_node_repository) {
|
||||||
ObjectLock xlock(old_node_repository);
|
ObjectLock xlock(old_node_repository);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, old_node_repository) {
|
for (const Dictionary::Pair& kv : old_node_repository) {
|
||||||
String old_host = kv.first;
|
String old_host = kv.first;
|
||||||
|
|
||||||
if (old_host == "localhost") {
|
if (old_host == "localhost") {
|
||||||
@ -180,7 +179,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
Array::Ptr new_services = new_node_repository->Get(old_host);
|
Array::Ptr new_services = new_node_repository->Get(old_host);
|
||||||
|
|
||||||
ObjectLock ylock(old_services);
|
ObjectLock ylock(old_services);
|
||||||
BOOST_FOREACH(const String& old_service, old_services) {
|
for (const String& old_service : old_services) {
|
||||||
/* check against black/whitelist before trying to remove service */
|
/* check against black/whitelist before trying to remove service */
|
||||||
if (NodeUtility::CheckAgainstBlackAndWhiteList("blacklist", old_node_name, old_host, old_service) &&
|
if (NodeUtility::CheckAgainstBlackAndWhiteList("blacklist", old_node_name, old_host, old_service) &&
|
||||||
!NodeUtility::CheckAgainstBlackAndWhiteList("whitelist", old_node_name, old_host, old_service)) {
|
!NodeUtility::CheckAgainstBlackAndWhiteList("whitelist", old_node_name, old_host, old_service)) {
|
||||||
@ -209,7 +208,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* next iterate over all nodes and add hosts/services */
|
/* next iterate over all nodes and add hosts/services */
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& node, nodes) {
|
for (const Dictionary::Ptr& node : nodes) {
|
||||||
Dictionary::Ptr repository = node->Get("repository");
|
Dictionary::Ptr repository = node->Get("repository");
|
||||||
String zone = node->Get("zone");
|
String zone = node->Get("zone");
|
||||||
String endpoint = node->Get("endpoint");
|
String endpoint = node->Get("endpoint");
|
||||||
@ -242,7 +241,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
|
|
||||||
if (repository) {
|
if (repository) {
|
||||||
ObjectLock olock(repository);
|
ObjectLock olock(repository);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, repository) {
|
for (const Dictionary::Pair& kv : repository) {
|
||||||
String host = kv.first;
|
String host = kv.first;
|
||||||
String host_pattern = host + ".conf";
|
String host_pattern = host + ".conf";
|
||||||
bool skip_host = false;
|
bool skip_host = false;
|
||||||
@ -253,7 +252,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const String& object_path, object_paths) {
|
for (const String& object_path : object_paths) {
|
||||||
if (object_path.Contains(host_pattern)) {
|
if (object_path.Contains(host_pattern)) {
|
||||||
Log(LogNotice, "cli")
|
Log(LogNotice, "cli")
|
||||||
<< "Host '" << host << "' already exists.";
|
<< "Host '" << host << "' already exists.";
|
||||||
@ -313,12 +312,12 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
}
|
}
|
||||||
|
|
||||||
ObjectLock xlock(services);
|
ObjectLock xlock(services);
|
||||||
BOOST_FOREACH(const String& service, services) {
|
for (const String& service : services) {
|
||||||
bool skip_service = false;
|
bool skip_service = false;
|
||||||
|
|
||||||
String service_pattern = host + "/" + service + ".conf";
|
String service_pattern = host + "/" + service + ".conf";
|
||||||
|
|
||||||
BOOST_FOREACH(const String& object_path, object_paths) {
|
for (const String& object_path : object_paths) {
|
||||||
if (object_path.Contains(service_pattern)) {
|
if (object_path.Contains(service_pattern)) {
|
||||||
Log(LogNotice, "cli")
|
Log(LogNotice, "cli")
|
||||||
<< "Service '" << service << "' on Host '" << host << "' already exists.";
|
<< "Service '" << service << "' on Host '" << host << "' already exists.";
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/configwriter.hpp"
|
#include "base/configwriter.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
@ -77,7 +76,7 @@ std::vector<String> NodeUtility::GetNodeCompletionSuggestions(const String& word
|
|||||||
{
|
{
|
||||||
std::vector<String> suggestions;
|
std::vector<String> suggestions;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& node, GetNodes()) {
|
for (const Dictionary::Ptr& node : GetNodes()) {
|
||||||
String node_name = node->Get("endpoint");
|
String node_name = node->Get("endpoint");
|
||||||
|
|
||||||
if (node_name.Find(word) == 0)
|
if (node_name.Find(word) == 0)
|
||||||
@ -91,7 +90,7 @@ void NodeUtility::PrintNodes(std::ostream& fp)
|
|||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& node, GetNodes()) {
|
for (const Dictionary::Ptr& node : GetNodes()) {
|
||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
else
|
else
|
||||||
@ -126,13 +125,13 @@ void NodeUtility::PrintNodeRepository(std::ostream& fp, const Dictionary::Ptr& r
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ObjectLock olock(repository);
|
ObjectLock olock(repository);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, repository) {
|
for (const Dictionary::Pair& kv : repository) {
|
||||||
fp << std::setw(4) << " "
|
fp << std::setw(4) << " "
|
||||||
<< "* Host '" << ConsoleColorTag(Console_ForegroundGreen | Console_Bold) << kv.first << ConsoleColorTag(Console_Normal) << "'\n";
|
<< "* Host '" << ConsoleColorTag(Console_ForegroundGreen | Console_Bold) << kv.first << ConsoleColorTag(Console_Normal) << "'\n";
|
||||||
|
|
||||||
Array::Ptr services = kv.second;
|
Array::Ptr services = kv.second;
|
||||||
ObjectLock xlock(services);
|
ObjectLock xlock(services);
|
||||||
BOOST_FOREACH(const String& service, services) {
|
for (const String& service : services) {
|
||||||
fp << std::setw(8) << " " << "* Service '" << ConsoleColorTag(Console_ForegroundGreen | Console_Bold) << service << ConsoleColorTag(Console_Normal) << "'\n";
|
fp << std::setw(8) << " " << "* Service '" << ConsoleColorTag(Console_ForegroundGreen | Console_Bold) << service << ConsoleColorTag(Console_Normal) << "'\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +141,7 @@ void NodeUtility::PrintNodesJson(std::ostream& fp)
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr result = new Dictionary();
|
Dictionary::Ptr result = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& node, GetNodes()) {
|
for (const Dictionary::Ptr& node : GetNodes()) {
|
||||||
result->Set(node->Get("endpoint"), node);
|
result->Set(node->Get("endpoint"), node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +263,7 @@ int NodeUtility::GenerateNodeIcingaConfig(const std::vector<std::string>& endpoi
|
|||||||
|
|
||||||
String master_zone_name = "master"; //TODO: Find a better name.
|
String master_zone_name = "master"; //TODO: Find a better name.
|
||||||
|
|
||||||
BOOST_FOREACH(const std::string& endpoint, endpoints) {
|
for (const std::string& endpoint : endpoints) {
|
||||||
|
|
||||||
/* extract all --endpoint arguments and store host,port info */
|
/* extract all --endpoint arguments and store host,port info */
|
||||||
std::vector<String> tokens;
|
std::vector<String> tokens;
|
||||||
@ -394,7 +393,7 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt
|
|||||||
fp << " */\n\n";
|
fp << " */\n\n";
|
||||||
|
|
||||||
ObjectLock olock(objects);
|
ObjectLock olock(objects);
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& object, objects) {
|
for (const Dictionary::Ptr& object : objects) {
|
||||||
SerializeObject(fp, object);
|
SerializeObject(fp, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +442,7 @@ int NodeUtility::UpdateBlackAndWhiteList(const String& type, const String& zone_
|
|||||||
{
|
{
|
||||||
ObjectLock olock(lists);
|
ObjectLock olock(lists);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& filter, lists) {
|
for (const Dictionary::Ptr& filter : lists) {
|
||||||
|
|
||||||
if (filter->Get("zone") == zone_filter) {
|
if (filter->Get("zone") == zone_filter) {
|
||||||
if (filter->Get("host") == host_filter && service_filter.IsEmpty()) {
|
if (filter->Get("host") == host_filter && service_filter.IsEmpty()) {
|
||||||
@ -484,7 +483,7 @@ int NodeUtility::RemoveBlackAndWhiteList(const String& type, const String& zone_
|
|||||||
{
|
{
|
||||||
ObjectLock olock(lists);
|
ObjectLock olock(lists);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& filter, lists) {
|
for (const Dictionary::Ptr& filter : lists) {
|
||||||
|
|
||||||
if (filter->Get("zone") == zone_filter) {
|
if (filter->Get("zone") == zone_filter) {
|
||||||
if (filter->Get("host") == host_filter && service_filter.IsEmpty()) {
|
if (filter->Get("host") == host_filter && service_filter.IsEmpty()) {
|
||||||
@ -509,7 +508,7 @@ int NodeUtility::RemoveBlackAndWhiteList(const String& type, const String& zone_
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(int remove, remove_filters) {
|
for (int remove : remove_filters) {
|
||||||
lists->Remove(remove);
|
lists->Remove(remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,7 +529,7 @@ int NodeUtility::PrintBlackAndWhiteList(std::ostream& fp, const String& type)
|
|||||||
fp << "Listing all " << type << " entries:\n";
|
fp << "Listing all " << type << " entries:\n";
|
||||||
|
|
||||||
ObjectLock olock(lists);
|
ObjectLock olock(lists);
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& filter, lists) {
|
for (const Dictionary::Ptr& filter : lists) {
|
||||||
fp << type << " filter for Node: '" << filter->Get("zone") << "' Host: '"
|
fp << type << " filter for Node: '" << filter->Get("zone") << "' Host: '"
|
||||||
<< filter->Get("host") << "' Service: '" << filter->Get("service") << "'.\n";
|
<< filter->Get("host") << "' Service: '" << filter->Get("service") << "'.\n";
|
||||||
}
|
}
|
||||||
@ -546,7 +545,7 @@ bool NodeUtility::CheckAgainstBlackAndWhiteList(const String& type, const String
|
|||||||
<< "Checking object against " << type << ".";
|
<< "Checking object against " << type << ".";
|
||||||
|
|
||||||
ObjectLock olock(lists);
|
ObjectLock olock(lists);
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& filter, lists) {
|
for (const Dictionary::Ptr& filter : lists) {
|
||||||
String zone_filter = filter->Get("zone");
|
String zone_filter = filter->Get("zone");
|
||||||
String host_filter = filter->Get("host");
|
String host_filter = filter->Get("host");
|
||||||
String service_filter;
|
String service_filter;
|
||||||
@ -620,7 +619,7 @@ void NodeUtility::SerializeObject(std::ostream& fp, const Dictionary::Ptr& objec
|
|||||||
fp << " {\n";
|
fp << " {\n";
|
||||||
|
|
||||||
ObjectLock olock(object);
|
ObjectLock olock(object);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, object) {
|
for (const Dictionary::Pair& kv : object) {
|
||||||
if (kv.first == "__type" || kv.first == "__name")
|
if (kv.first == "__type" || kv.first == "__name")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "base/tlsutility.hpp"
|
#include "base/tlsutility.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
#include <boost/algorithm/string/case_conv.hpp>
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "base/debug.hpp"
|
#include "base/debug.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -129,7 +128,7 @@ void ObjectListCommand::PrintTypeCounts(std::ostream& fp, const std::map<String,
|
|||||||
{
|
{
|
||||||
typedef std::map<String, int>::value_type TypeCount;
|
typedef std::map<String, int>::value_type TypeCount;
|
||||||
|
|
||||||
BOOST_FOREACH(const TypeCount& kv, type_count) {
|
for (const TypeCount& kv : type_count) {
|
||||||
fp << "Found " << kv.second << " " << kv.first << " object";
|
fp << "Found " << kv.second << " " << kv.first << " object";
|
||||||
|
|
||||||
if (kv.second != 1)
|
if (kv.second != 1)
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
@ -77,7 +76,7 @@ void ObjectListUtility::PrintProperties(std::ostream& fp, const Dictionary::Ptr&
|
|||||||
int offset = 2;
|
int offset = 2;
|
||||||
|
|
||||||
ObjectLock olock(props);
|
ObjectLock olock(props);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, props)
|
for (const Dictionary::Pair& kv : props)
|
||||||
{
|
{
|
||||||
String key = kv.first;
|
String key = kv.first;
|
||||||
Value val = kv.second;
|
Value val = kv.second;
|
||||||
@ -114,7 +113,7 @@ void ObjectListUtility::PrintHints(std::ostream& fp, const Dictionary::Ptr& debu
|
|||||||
if (messages) {
|
if (messages) {
|
||||||
ObjectLock olock(messages);
|
ObjectLock olock(messages);
|
||||||
|
|
||||||
BOOST_FOREACH(const Value& msg, messages)
|
for (const Value& msg : messages)
|
||||||
{
|
{
|
||||||
PrintHint(fp, msg, indent);
|
PrintHint(fp, msg, indent);
|
||||||
}
|
}
|
||||||
@ -155,7 +154,7 @@ void ObjectListUtility::PrintArray(std::ostream& fp, const Array::Ptr& arr)
|
|||||||
|
|
||||||
if (arr) {
|
if (arr) {
|
||||||
ObjectLock olock(arr);
|
ObjectLock olock(arr);
|
||||||
BOOST_FOREACH(const Value& value, arr)
|
for (const Value& value : arr)
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -164,7 +163,7 @@ int RepositoryObjectCommand::Run(const boost::program_options::variables_map& vm
|
|||||||
if (vm.count("import")) {
|
if (vm.count("import")) {
|
||||||
Array::Ptr imports = new Array();
|
Array::Ptr imports = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const String& import, vm["import"].as<std::vector<std::string> >()) {
|
for (const String& import : vm["import"].as<std::vector<std::string> >()) {
|
||||||
imports->Add(import);
|
imports->Add(import);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include "base/serializer.hpp"
|
#include "base/serializer.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
@ -49,7 +48,7 @@ Dictionary::Ptr RepositoryUtility::GetArgumentAttributes(const std::vector<std::
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr attrs = new Dictionary();
|
Dictionary::Ptr attrs = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const String& kv, arguments) {
|
for (const String& kv : arguments) {
|
||||||
std::vector<String> tokens;
|
std::vector<String> tokens;
|
||||||
boost::algorithm::split(tokens, kv, boost::is_any_of("="));
|
boost::algorithm::split(tokens, kv, boost::is_any_of("="));
|
||||||
|
|
||||||
@ -144,7 +143,7 @@ void RepositoryUtility::PrintObjects(std::ostream& fp, const String& type)
|
|||||||
{
|
{
|
||||||
std::vector<String> objects = GetObjects(); //full path
|
std::vector<String> objects = GetObjects(); //full path
|
||||||
|
|
||||||
BOOST_FOREACH(const String& object, objects) {
|
for (const String& object : objects) {
|
||||||
if (!FilterRepositoryObjects(type, object)) {
|
if (!FilterRepositoryObjects(type, object)) {
|
||||||
Log(LogDebug, "cli")
|
Log(LogDebug, "cli")
|
||||||
<< "Ignoring object '" << object << "'. Type '" << type << "' does not match.";
|
<< "Ignoring object '" << object << "'. Type '" << type << "' does not match.";
|
||||||
@ -184,7 +183,7 @@ void RepositoryUtility::PrintChangeLog(std::ostream& fp)
|
|||||||
|
|
||||||
std::cout << "Changes to be committed:\n\n";
|
std::cout << "Changes to be committed:\n\n";
|
||||||
|
|
||||||
BOOST_FOREACH(const Value& entry, changelog) {
|
for (const Value& entry : changelog) {
|
||||||
FormatChangelogEntry(std::cout, entry);
|
FormatChangelogEntry(std::cout, entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,7 +208,7 @@ bool RepositoryUtility::AddObject(const std::vector<String>& object_paths, const
|
|||||||
else
|
else
|
||||||
pattern = EscapeName(name) + ".conf";
|
pattern = EscapeName(name) + ".conf";
|
||||||
|
|
||||||
BOOST_FOREACH(const String& object_path, object_paths) {
|
for (const String& object_path : object_paths) {
|
||||||
if (object_path.Contains(pattern)) {
|
if (object_path.Contains(pattern)) {
|
||||||
Log(LogWarning, "cli")
|
Log(LogWarning, "cli")
|
||||||
<< type << " '" << name << "' already exists. Skipping creation.";
|
<< type << " '" << name << "' already exists. Skipping creation.";
|
||||||
@ -303,7 +302,7 @@ bool RepositoryUtility::CheckChangeExists(const Dictionary::Ptr& change, const A
|
|||||||
Dictionary::Ptr attrs = change->Get("attrs");
|
Dictionary::Ptr attrs = change->Get("attrs");
|
||||||
|
|
||||||
ObjectLock olock(changes);
|
ObjectLock olock(changes);
|
||||||
BOOST_FOREACH(const Dictionary::Ptr& entry, changes) {
|
for (const Dictionary::Ptr& entry : changes) {
|
||||||
if (entry->Get("type") != change->Get("type"))
|
if (entry->Get("type") != change->Get("type"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -432,7 +431,7 @@ bool RepositoryUtility::RemoveObjectInternal(const String& name, const String& t
|
|||||||
boost::bind(&RepositoryUtility::CollectObjects, _1, boost::ref(files)), GlobFile);
|
boost::bind(&RepositoryUtility::CollectObjects, _1, boost::ref(files)), GlobFile);
|
||||||
|
|
||||||
|
|
||||||
BOOST_FOREACH(const String& file, files) {
|
for (const String& file : files) {
|
||||||
RemoveObjectFileInternal(file);
|
RemoveObjectFileInternal(file);
|
||||||
}
|
}
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -569,7 +568,7 @@ bool RepositoryUtility::GetChangeLog(const boost::function<void (const Dictionar
|
|||||||
/* sort by timestamp ascending */
|
/* sort by timestamp ascending */
|
||||||
std::sort(changelog.begin(), changelog.end());
|
std::sort(changelog.begin(), changelog.end());
|
||||||
|
|
||||||
BOOST_FOREACH(const String& entry, changelog) {
|
for (const String& entry : changelog) {
|
||||||
String file = path + entry + ".change";
|
String file = path + entry + ".change";
|
||||||
Dictionary::Ptr change = GetObjectFromRepositoryChangeLog(file);
|
Dictionary::Ptr change = GetObjectFromRepositoryChangeLog(file);
|
||||||
|
|
||||||
@ -664,7 +663,7 @@ void RepositoryUtility::FormatChangelogEntry(std::ostream& fp, const Dictionary:
|
|||||||
fp << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << change->Get("name") << ConsoleColorTag(Console_Normal) << "'\n";
|
fp << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << change->Get("name") << ConsoleColorTag(Console_Normal) << "'\n";
|
||||||
|
|
||||||
ObjectLock olock(attrs);
|
ObjectLock olock(attrs);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, attrs) {
|
for (const Dictionary::Pair& kv : attrs) {
|
||||||
/* skip the name */
|
/* skip the name */
|
||||||
if (kv.first == "name" || kv.first == "__name")
|
if (kv.first == "name" || kv.first == "__name")
|
||||||
continue;
|
continue;
|
||||||
@ -694,7 +693,7 @@ void RepositoryUtility::SerializeObject(std::ostream& fp, const String& name, co
|
|||||||
Array::Ptr imports = object->Get("import");
|
Array::Ptr imports = object->Get("import");
|
||||||
|
|
||||||
ObjectLock olock(imports);
|
ObjectLock olock(imports);
|
||||||
BOOST_FOREACH(const String& import, imports) {
|
for (const String& import : imports) {
|
||||||
fp << "\t" << "import ";
|
fp << "\t" << "import ";
|
||||||
ConfigWriter::EmitString(fp, import);
|
ConfigWriter::EmitString(fp, import);
|
||||||
fp << '\n';
|
fp << '\n';
|
||||||
@ -702,7 +701,7 @@ void RepositoryUtility::SerializeObject(std::ostream& fp, const String& name, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
ObjectLock xlock(object);
|
ObjectLock xlock(object);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, object) {
|
for (const Dictionary::Pair& kv : object) {
|
||||||
if (kv.first == "import" || kv.first == "name" || kv.first == "__name") {
|
if (kv.first == "import" || kv.first == "name" || kv.first == "__name") {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/circular_buffer.hpp>
|
#include <boost/circular_buffer.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -325,9 +324,9 @@ bool TroubleshootCommand::CheckFeatures(InfoLog& log)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const String feature, disabled_features)
|
for (const String feature : disabled_features)
|
||||||
features->Set(feature, false);
|
features->Set(feature, false);
|
||||||
BOOST_FOREACH(const String feature, enabled_features)
|
for (const String feature : enabled_features)
|
||||||
features->Set(feature, true);
|
features->Set(feature, true);
|
||||||
|
|
||||||
InfoLogLine(log)
|
InfoLogLine(log)
|
||||||
@ -518,7 +517,7 @@ void TroubleshootCommand::CheckObjectFile(const String& objectfile, InfoLog& log
|
|||||||
Dictionary::Ptr properties = object->Get("properties");
|
Dictionary::Ptr properties = object->Get("properties");
|
||||||
|
|
||||||
ObjectLock olock(properties);
|
ObjectLock olock(properties);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, properties) {
|
for (const Dictionary::Pair& kv : properties) {
|
||||||
if (Utility::Match(kv.first, "path"))
|
if (Utility::Match(kv.first, "path"))
|
||||||
logs->Set(name, kv.second);
|
logs->Set(name, kv.second);
|
||||||
}
|
}
|
||||||
@ -540,7 +539,7 @@ void TroubleshootCommand::CheckObjectFile(const String& objectfile, InfoLog& log
|
|||||||
<< "Found the " << countTotal << " objects:\n"
|
<< "Found the " << countTotal << " objects:\n"
|
||||||
<< " Type" << std::string(typeL-4, ' ') << " : Count\n";
|
<< " Type" << std::string(typeL-4, ' ') << " : Count\n";
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, type_count) {
|
for (const Dictionary::Pair& kv : type_count) {
|
||||||
InfoLogLine(log)
|
InfoLogLine(log)
|
||||||
<< " " << kv.first << std::string(typeL - kv.first.GetLength(), ' ')
|
<< " " << kv.first << std::string(typeL - kv.first.GetLength(), ' ')
|
||||||
<< " : " << kv.second << '\n';
|
<< " : " << kv.second << '\n';
|
||||||
@ -577,7 +576,7 @@ void TroubleshootCommand::PrintLoggers(InfoLog& log, Dictionary::Ptr& logs)
|
|||||||
<< "Getting the last 20 lines of " << logs->GetLength() << " FileLogger objects.\n";
|
<< "Getting the last 20 lines of " << logs->GetLength() << " FileLogger objects.\n";
|
||||||
|
|
||||||
ObjectLock ulock(logs);
|
ObjectLock ulock(logs);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, logs) {
|
for (const Dictionary::Pair& kv : logs) {
|
||||||
InfoLogLine(log)
|
InfoLogLine(log)
|
||||||
<< "Logger " << kv.first << " at path: " << kv.second << '\n';
|
<< "Logger " << kv.first << " at path: " << kv.second << '\n';
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "base/debug.hpp"
|
#include "base/debug.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/console.hpp"
|
#include "base/console.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -44,7 +44,7 @@ void CheckResultReader::StatsFunc(const Dictionary::Ptr& status, const Array::Pt
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const CheckResultReader::Ptr& checkresultreader, ConfigType::GetObjectsByType<CheckResultReader>()) {
|
for (const CheckResultReader::Ptr& checkresultreader : ConfigType::GetObjectsByType<CheckResultReader>()) {
|
||||||
nodes->Set(checkresultreader->GetName(), 1); //add more stats
|
nodes->Set(checkresultreader->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -47,7 +46,7 @@ void CompatLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const CompatLogger::Ptr& compat_logger, ConfigType::GetObjectsByType<CompatLogger>()) {
|
for (const CompatLogger::Ptr& compat_logger : ConfigType::GetObjectsByType<CompatLogger>()) {
|
||||||
nodes->Set(compat_logger->GetName(), 1); //add more stats
|
nodes->Set(compat_logger->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,7 +475,7 @@ void CompatLogger::ReopenFile(bool rotate)
|
|||||||
WriteLine("LOG ROTATION: " + GetRotationMethod());
|
WriteLine("LOG ROTATION: " + GetRotationMethod());
|
||||||
WriteLine("LOG VERSION: 2.0");
|
WriteLine("LOG VERSION: 2.0");
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
|
||||||
String output;
|
String output;
|
||||||
CheckResult::Ptr cr = host->GetLastCheckResult();
|
CheckResult::Ptr cr = host->GetLastCheckResult();
|
||||||
|
|
||||||
@ -494,7 +493,7 @@ void CompatLogger::ReopenFile(bool rotate)
|
|||||||
WriteLine(msgbuf.str());
|
WriteLine(msgbuf.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
for (const Service::Ptr& service : ConfigType::GetObjectsByType<Service>()) {
|
||||||
Host::Ptr host = service->GetHost();
|
Host::Ptr host = service->GetHost();
|
||||||
|
|
||||||
String output;
|
String output;
|
||||||
|
@ -36,7 +36,7 @@ void ExternalCommandListener::StatsFunc(const Dictionary::Ptr& status, const Arr
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const ExternalCommandListener::Ptr& externalcommandlistener, ConfigType::GetObjectsByType<ExternalCommandListener>()) {
|
for (const ExternalCommandListener::Ptr& externalcommandlistener : ConfigType::GetObjectsByType<ExternalCommandListener>()) {
|
||||||
nodes->Set(externalcommandlistener->GetName(), 1); //add more stats
|
nodes->Set(externalcommandlistener->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
@ -54,7 +53,7 @@ void StatusDataWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const StatusDataWriter::Ptr& statusdatawriter, ConfigType::GetObjectsByType<StatusDataWriter>()) {
|
for (const StatusDataWriter::Ptr& statusdatawriter : ConfigType::GetObjectsByType<StatusDataWriter>()) {
|
||||||
nodes->Set(statusdatawriter->GetName(), 1); //add more stats
|
nodes->Set(statusdatawriter->GetName(), 1); //add more stats
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +91,7 @@ void StatusDataWriter::DumpComments(std::ostream& fp, const Checkable::Ptr& chec
|
|||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
|
||||||
BOOST_FOREACH(const Comment::Ptr& comment, checkable->GetComments()) {
|
for (const Comment::Ptr& comment : checkable->GetComments()) {
|
||||||
if (comment->IsExpired())
|
if (comment->IsExpired())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -126,7 +125,7 @@ void StatusDataWriter::DumpTimePeriod(std::ostream& fp, const TimePeriod::Ptr& t
|
|||||||
|
|
||||||
if (ranges) {
|
if (ranges) {
|
||||||
ObjectLock olock(ranges);
|
ObjectLock olock(ranges);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
|
for (const Dictionary::Pair& kv : ranges) {
|
||||||
fp << "\t" << kv.first << "\t" << kv.second << "\n";
|
fp << "\t" << kv.first << "\t" << kv.second << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +157,7 @@ void StatusDataWriter::DumpDowntimes(std::ostream& fp, const Checkable::Ptr& che
|
|||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
|
||||||
BOOST_FOREACH(const Downtime::Ptr& downtime, checkable->GetDowntimes()) {
|
for (const Downtime::Ptr& downtime : checkable->GetDowntimes()) {
|
||||||
if (downtime->IsExpired())
|
if (downtime->IsExpired())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -296,7 +295,7 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
|
|||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
BOOST_FOREACH(const String& name, groups) {
|
for (const String& name : groups) {
|
||||||
HostGroup::Ptr hg = HostGroup::GetByName(name);
|
HostGroup::Ptr hg = HostGroup::GetByName(name);
|
||||||
|
|
||||||
if (hg) {
|
if (hg) {
|
||||||
@ -481,7 +480,7 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
|
|||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
BOOST_FOREACH(const String& name, groups) {
|
for (const String& name : groups) {
|
||||||
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
|
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
|
||||||
|
|
||||||
if (sg) {
|
if (sg) {
|
||||||
@ -513,7 +512,7 @@ void StatusDataWriter::DumpCustomAttributes(std::ostream& fp, const CustomVarObj
|
|||||||
bool is_json = false;
|
bool is_json = false;
|
||||||
|
|
||||||
ObjectLock olock(vars);
|
ObjectLock olock(vars);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
|
for (const Dictionary::Pair& kv : vars) {
|
||||||
if (kv.first.IsEmpty())
|
if (kv.first.IsEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -547,13 +546,13 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
"# This file is auto-generated. Do not modify this file." "\n"
|
"# This file is auto-generated. Do not modify this file." "\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
DumpHostObject(tempobjectfp, host);
|
DumpHostObject(tempobjectfp, host);
|
||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
|
for (const Service::Ptr& service : host->GetServices()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
DumpServiceObject(tempobjectfp, service);
|
DumpServiceObject(tempobjectfp, service);
|
||||||
@ -561,7 +560,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const HostGroup::Ptr& hg, ConfigType::GetObjectsByType<HostGroup>()) {
|
for (const HostGroup::Ptr& hg : ConfigType::GetObjectsByType<HostGroup>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
|
|
||||||
@ -592,7 +591,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const ServiceGroup::Ptr& sg, ConfigType::GetObjectsByType<ServiceGroup>()) {
|
for (const ServiceGroup::Ptr& sg : ConfigType::GetObjectsByType<ServiceGroup>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
|
|
||||||
@ -618,7 +617,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
tempobjectfp << "\t" "members" "\t";
|
tempobjectfp << "\t" "members" "\t";
|
||||||
|
|
||||||
std::vector<String> sglist;
|
std::vector<String> sglist;
|
||||||
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
|
for (const Service::Ptr& service : sg->GetMembers()) {
|
||||||
Host::Ptr host = service->GetHost();
|
Host::Ptr host = service->GetHost();
|
||||||
|
|
||||||
sglist.push_back(host->GetName());
|
sglist.push_back(host->GetName());
|
||||||
@ -633,7 +632,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const User::Ptr& user, ConfigType::GetObjectsByType<User>()) {
|
for (const User::Ptr& user : ConfigType::GetObjectsByType<User>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
|
|
||||||
@ -661,7 +660,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const UserGroup::Ptr& ug, ConfigType::GetObjectsByType<UserGroup>()) {
|
for (const UserGroup::Ptr& ug : ConfigType::GetObjectsByType<UserGroup>()) {
|
||||||
std::ostringstream tempobjectfp;
|
std::ostringstream tempobjectfp;
|
||||||
tempobjectfp << std::fixed;
|
tempobjectfp << std::fixed;
|
||||||
|
|
||||||
@ -677,23 +676,23 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
|||||||
objectfp << tempobjectfp.str();
|
objectfp << tempobjectfp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<CheckCommand>()) {
|
for (const Command::Ptr& command : ConfigType::GetObjectsByType<CheckCommand>()) {
|
||||||
DumpCommand(objectfp, command);
|
DumpCommand(objectfp, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<NotificationCommand>()) {
|
for (const Command::Ptr& command : ConfigType::GetObjectsByType<NotificationCommand>()) {
|
||||||
DumpCommand(objectfp, command);
|
DumpCommand(objectfp, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Command::Ptr& command, ConfigType::GetObjectsByType<EventCommand>()) {
|
for (const Command::Ptr& command : ConfigType::GetObjectsByType<EventCommand>()) {
|
||||||
DumpCommand(objectfp, command);
|
DumpCommand(objectfp, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const TimePeriod::Ptr& tp, ConfigType::GetObjectsByType<TimePeriod>()) {
|
for (const TimePeriod::Ptr& tp : ConfigType::GetObjectsByType<TimePeriod>()) {
|
||||||
DumpTimePeriod(objectfp, tp);
|
DumpTimePeriod(objectfp, tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, ConfigType::GetObjectsByType<Dependency>()) {
|
for (const Dependency::Ptr& dep : ConfigType::GetObjectsByType<Dependency>()) {
|
||||||
Checkable::Ptr parent = dep->GetParent();
|
Checkable::Ptr parent = dep->GetParent();
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
@ -824,13 +823,13 @@ void StatusDataWriter::StatusTimerHandler(void)
|
|||||||
statusfp << "\t" "}" "\n"
|
statusfp << "\t" "}" "\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
|
||||||
std::ostringstream tempstatusfp;
|
std::ostringstream tempstatusfp;
|
||||||
tempstatusfp << std::fixed;
|
tempstatusfp << std::fixed;
|
||||||
DumpHostStatus(tempstatusfp, host);
|
DumpHostStatus(tempstatusfp, host);
|
||||||
statusfp << tempstatusfp.str();
|
statusfp << tempstatusfp.str();
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
|
for (const Service::Ptr& service : host->GetServices()) {
|
||||||
std::ostringstream tempstatusfp;
|
std::ostringstream tempstatusfp;
|
||||||
tempstatusfp << std::fixed;
|
tempstatusfp << std::fixed;
|
||||||
DumpServiceStatus(tempstatusfp, service);
|
DumpServiceStatus(tempstatusfp, service);
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "config/applyrule.hpp"
|
#include "config/applyrule.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -121,7 +120,7 @@ bool ApplyRule::IsValidTargetType(const String& sourceType, const String& target
|
|||||||
if (it->second.size() == 1 && targetType == "")
|
if (it->second.size() == 1 && targetType == "")
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
BOOST_FOREACH(const String& type, it->second) {
|
for (const String& type : it->second) {
|
||||||
if (type == targetType)
|
if (type == targetType)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -161,8 +160,8 @@ std::vector<ApplyRule>& ApplyRule::GetRules(const String& type)
|
|||||||
|
|
||||||
void ApplyRule::CheckMatches(void)
|
void ApplyRule::CheckMatches(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const RuleMap::value_type& kv, m_Rules) {
|
for (const RuleMap::value_type& kv : m_Rules) {
|
||||||
BOOST_FOREACH(const ApplyRule& rule, kv.second) {
|
for (const ApplyRule& rule : kv.second) {
|
||||||
if (!rule.HasMatches())
|
if (!rule.HasMatches())
|
||||||
Log(LogWarning, "ApplyRule")
|
Log(LogWarning, "ApplyRule")
|
||||||
<< "Apply rule '" << rule.GetName() << "' (" << rule.GetDebugInfo() << ") for type '" << kv.first << "' does not match anywhere!";
|
<< "Apply rule '" << rule.GetName() << "' (" << rule.GetDebugInfo() << ") for type '" << kv.first << "' does not match anywhere!";
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
#define YYLTYPE icinga::CompilerDebugInfo
|
#define YYLTYPE icinga::CompilerDebugInfo
|
||||||
#define YYERROR_VERBOSE
|
#define YYERROR_VERBOSE
|
||||||
@ -280,9 +279,8 @@ Expression *ConfigCompiler::Compile(void)
|
|||||||
m_IgnoreNewlines.pop();
|
m_IgnoreNewlines.pop();
|
||||||
|
|
||||||
std::vector<Expression *> dlist;
|
std::vector<Expression *> dlist;
|
||||||
typedef std::pair<Expression *, EItemInfo> EListItem;
|
|
||||||
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
||||||
BOOST_FOREACH(const EListItem& litem, llist) {
|
for (const auto& litem : llist) {
|
||||||
if (!litem.second.SideEffect && num != llist.size() - 1) {
|
if (!litem.second.SideEffect && num != llist.size() - 1) {
|
||||||
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
||||||
}
|
}
|
||||||
@ -732,7 +730,7 @@ rterm_dict: '{'
|
|||||||
std::vector<Expression *> dlist;
|
std::vector<Expression *> dlist;
|
||||||
typedef std::pair<Expression *, EItemInfo> EListItem;
|
typedef std::pair<Expression *, EItemInfo> EListItem;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
BOOST_FOREACH(const EListItem& litem, *$3) {
|
for (const EListItem& litem : *$3) {
|
||||||
if (!litem.second.SideEffect)
|
if (!litem.second.SideEffect)
|
||||||
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
||||||
dlist.push_back(litem.first);
|
dlist.push_back(litem.first);
|
||||||
@ -755,7 +753,7 @@ rterm_scope_require_side_effect: '{'
|
|||||||
std::vector<Expression *> dlist;
|
std::vector<Expression *> dlist;
|
||||||
typedef std::pair<Expression *, EItemInfo> EListItem;
|
typedef std::pair<Expression *, EItemInfo> EListItem;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
BOOST_FOREACH(const EListItem& litem, *$3) {
|
for (const EListItem& litem : *$3) {
|
||||||
if (!litem.second.SideEffect)
|
if (!litem.second.SideEffect)
|
||||||
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
||||||
dlist.push_back(litem.first);
|
dlist.push_back(litem.first);
|
||||||
@ -779,7 +777,7 @@ rterm_scope: '{'
|
|||||||
std::vector<Expression *> dlist;
|
std::vector<Expression *> dlist;
|
||||||
typedef std::pair<Expression *, EItemInfo> EListItem;
|
typedef std::pair<Expression *, EItemInfo> EListItem;
|
||||||
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
||||||
BOOST_FOREACH(const EListItem& litem, *$3) {
|
for (const EListItem& litem : *$3) {
|
||||||
if (!litem.second.SideEffect && num != $3->size() - 1)
|
if (!litem.second.SideEffect && num != $3->size() - 1)
|
||||||
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
||||||
dlist.push_back(litem.first);
|
dlist.push_back(litem.first);
|
||||||
@ -1007,7 +1005,7 @@ rterm_no_side_effect_no_dict: T_STRING
|
|||||||
std::vector<Expression *> dlist;
|
std::vector<Expression *> dlist;
|
||||||
typedef std::pair<Expression *, EItemInfo> EListItem;
|
typedef std::pair<Expression *, EItemInfo> EListItem;
|
||||||
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
||||||
BOOST_FOREACH(const EListItem& litem, *$3) {
|
for (const EListItem& litem : *$3) {
|
||||||
if (!litem.second.SideEffect && num != $3->size() - 1)
|
if (!litem.second.SideEffect && num != $3->size() - 1)
|
||||||
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
||||||
dlist.push_back(litem.first);
|
dlist.push_back(litem.first);
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -144,7 +143,7 @@ Expression *ConfigCompiler::HandleInclude(const String& relativeBase, const Stri
|
|||||||
String includePath = upath;
|
String includePath = upath;
|
||||||
|
|
||||||
if (search) {
|
if (search) {
|
||||||
BOOST_FOREACH(const String& dir, m_IncludeSearchDirs) {
|
for (const String& dir : m_IncludeSearchDirs) {
|
||||||
String spath = dir + "/" + path;
|
String spath = dir + "/" + path;
|
||||||
|
|
||||||
if (Utility::PathExists(spath)) {
|
if (Utility::PathExists(spath)) {
|
||||||
@ -341,7 +340,7 @@ bool ConfigCompiler::HasZoneConfigAuthority(const String& zoneName)
|
|||||||
|
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
std::vector<String> paths;
|
std::vector<String> paths;
|
||||||
BOOST_FOREACH(const ZoneFragment& zf, zoneDirs) {
|
for (const ZoneFragment& zf : zoneDirs) {
|
||||||
paths.push_back(zf.Path);
|
paths.push_back(zf.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include "base/netstring.hpp"
|
#include "base/netstring.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include "base/function.hpp"
|
#include "base/function.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -409,8 +408,8 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
BOOST_FOREACH(const TypeMap::value_type& kv, m_Items) {
|
for (const TypeMap::value_type& kv : m_Items) {
|
||||||
BOOST_FOREACH(const ItemMap::value_type& kv2, kv.second) {
|
for (const ItemMap::value_type& kv2 : kv.second) {
|
||||||
if (kv2.second->m_Abstract || kv2.second->m_Object)
|
if (kv2.second->m_Abstract || kv2.second->m_Object)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -423,7 +422,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
|
|
||||||
ItemList newUnnamedItems;
|
ItemList newUnnamedItems;
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, m_UnnamedItems) {
|
for (const ConfigItem::Ptr& item : m_UnnamedItems) {
|
||||||
if (item->m_ActivationContext != context) {
|
if (item->m_ActivationContext != context) {
|
||||||
newUnnamedItems.push_back(item);
|
newUnnamedItems.push_back(item);
|
||||||
continue;
|
continue;
|
||||||
@ -441,7 +440,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
if (items.empty())
|
if (items.empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
BOOST_FOREACH(const ItemPair& ip, items) {
|
for (const ItemPair& ip : items) {
|
||||||
newItems.push_back(ip.first);
|
newItems.push_back(ip.first);
|
||||||
upq.Enqueue(boost::bind(&ConfigItem::Commit, ip.first, ip.second));
|
upq.Enqueue(boost::bind(&ConfigItem::Commit, ip.first, ip.second));
|
||||||
}
|
}
|
||||||
@ -453,7 +452,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
|
|
||||||
std::set<String> types;
|
std::set<String> types;
|
||||||
|
|
||||||
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
|
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
||||||
if (ConfigObject::TypeInstance->IsAssignableFrom(type))
|
if (ConfigObject::TypeInstance->IsAssignableFrom(type))
|
||||||
types.insert(type->GetName());
|
types.insert(type->GetName());
|
||||||
}
|
}
|
||||||
@ -461,7 +460,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
std::set<String> completed_types;
|
std::set<String> completed_types;
|
||||||
|
|
||||||
while (types.size() != completed_types.size()) {
|
while (types.size() != completed_types.size()) {
|
||||||
BOOST_FOREACH(const String& type, types) {
|
for (const String& type : types) {
|
||||||
if (completed_types.find(type) != completed_types.end())
|
if (completed_types.find(type) != completed_types.end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -469,7 +468,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
bool unresolved_dep = false;
|
bool unresolved_dep = false;
|
||||||
|
|
||||||
/* skip this type (for now) if there are unresolved load dependencies */
|
/* skip this type (for now) if there are unresolved load dependencies */
|
||||||
BOOST_FOREACH(const String& loadDep, ptype->GetLoadDependencies()) {
|
for (const String& loadDep : ptype->GetLoadDependencies()) {
|
||||||
if (types.find(loadDep) != types.end() && completed_types.find(loadDep) == completed_types.end()) {
|
if (types.find(loadDep) != types.end() && completed_types.find(loadDep) == completed_types.end()) {
|
||||||
unresolved_dep = true;
|
unresolved_dep = true;
|
||||||
break;
|
break;
|
||||||
@ -479,7 +478,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
if (unresolved_dep)
|
if (unresolved_dep)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOST_FOREACH(const ItemPair& ip, items) {
|
for (const ItemPair& ip : items) {
|
||||||
const ConfigItem::Ptr& item = ip.first;
|
const ConfigItem::Ptr& item = ip.first;
|
||||||
|
|
||||||
if (!item->m_Object)
|
if (!item->m_Object)
|
||||||
@ -496,8 +495,8 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
if (upq.HasExceptions())
|
if (upq.HasExceptions())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BOOST_FOREACH(const String& loadDep, ptype->GetLoadDependencies()) {
|
for (const String& loadDep : ptype->GetLoadDependencies()) {
|
||||||
BOOST_FOREACH(const ItemPair& ip, items) {
|
for (const ItemPair& ip : items) {
|
||||||
const ConfigItem::Ptr& item = ip.first;
|
const ConfigItem::Ptr& item = ip.first;
|
||||||
|
|
||||||
if (!item->m_Object)
|
if (!item->m_Object)
|
||||||
@ -529,7 +528,7 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
|
|||||||
if (!CommitNewItems(context, upq, newItems)) {
|
if (!CommitNewItems(context, upq, newItems)) {
|
||||||
upq.ReportExceptions("config");
|
upq.ReportExceptions("config");
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
|
for (const ConfigItem::Ptr& item : newItems) {
|
||||||
item->Unregister();
|
item->Unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,14 +541,14 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u
|
|||||||
/* log stats for external parsers */
|
/* log stats for external parsers */
|
||||||
typedef std::map<Type::Ptr, int> ItemCountMap;
|
typedef std::map<Type::Ptr, int> ItemCountMap;
|
||||||
ItemCountMap itemCounts;
|
ItemCountMap itemCounts;
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
|
for (const ConfigItem::Ptr& item : newItems) {
|
||||||
if (!item->m_Object)
|
if (!item->m_Object)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
itemCounts[item->m_Object->GetReflectionType()]++;
|
itemCounts[item->m_Object->GetReflectionType()]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const ItemCountMap::value_type& kv, itemCounts) {
|
for (const ItemCountMap::value_type& kv : itemCounts) {
|
||||||
Log(LogInformation, "ConfigItem")
|
Log(LogInformation, "ConfigItem")
|
||||||
<< "Instantiated " << kv.second << " " << (kv.second != 1 ? kv.first->GetPluralName() : kv.first->GetName()) << ".";
|
<< "Instantiated " << kv.second << " " << (kv.second != 1 ? kv.first->GetPluralName() : kv.first->GetName()) << ".";
|
||||||
}
|
}
|
||||||
@ -566,7 +565,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr
|
|||||||
if (!silent)
|
if (!silent)
|
||||||
Log(LogInformation, "ConfigItem", "Triggering Start signal for config items");
|
Log(LogInformation, "ConfigItem", "Triggering Start signal for config items");
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
|
for (const ConfigItem::Ptr& item : newItems) {
|
||||||
if (!item->m_Object)
|
if (!item->m_Object)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -590,7 +589,7 @@ bool ConfigItem::ActivateItems(WorkQueue& upq, const std::vector<ConfigItem::Ptr
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
BOOST_FOREACH(const ConfigItem::Ptr& item, newItems) {
|
for (const ConfigItem::Ptr& item : newItems) {
|
||||||
ConfigObject::Ptr object = item->m_Object;
|
ConfigObject::Ptr object = item->m_Object;
|
||||||
|
|
||||||
if (!object)
|
if (!object)
|
||||||
@ -640,7 +639,7 @@ std::vector<ConfigItem::Ptr> ConfigItem::GetItems(const String& type)
|
|||||||
if (it == m_Items.end())
|
if (it == m_Items.end())
|
||||||
return items;
|
return items;
|
||||||
|
|
||||||
BOOST_FOREACH(const ItemMap::value_type& kv, it->second)
|
for (const ItemMap::value_type& kv : it->second)
|
||||||
{
|
{
|
||||||
items.push_back(kv.second);
|
items.push_back(kv.second);
|
||||||
}
|
}
|
||||||
@ -652,7 +651,7 @@ void ConfigItem::RemoveIgnoredItems(const String& allowedConfigPath)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
BOOST_FOREACH(const String& path, m_IgnoredItems) {
|
for (const String& path : m_IgnoredItems) {
|
||||||
if (path.Find(allowedConfigPath) == String::NPos)
|
if (path.Find(allowedConfigPath) == String::NPos)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "config/configitembuilder.hpp"
|
#include "config/configitembuilder.hpp"
|
||||||
#include "base/configtype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/smart_ptr/make_shared.hpp>
|
#include <boost/smart_ptr/make_shared.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/scriptglobal.hpp"
|
#include "base/scriptglobal.hpp"
|
||||||
#include "base/loader.hpp"
|
#include "base/loader.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/exception_ptr.hpp>
|
#include <boost/exception_ptr.hpp>
|
||||||
#include <boost/exception/errinfo_nested_exception.hpp>
|
#include <boost/exception/errinfo_nested_exception.hpp>
|
||||||
|
|
||||||
@ -429,7 +428,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
|
|||||||
|
|
||||||
if (vfunc.IsObjectType<Type>()) {
|
if (vfunc.IsObjectType<Type>()) {
|
||||||
std::vector<Value> arguments;
|
std::vector<Value> arguments;
|
||||||
BOOST_FOREACH(Expression *arg, m_Args) {
|
for (Expression *arg : m_Args) {
|
||||||
ExpressionResult argres = arg->Evaluate(frame);
|
ExpressionResult argres = arg->Evaluate(frame);
|
||||||
CHECK_RESULT(argres);
|
CHECK_RESULT(argres);
|
||||||
|
|
||||||
@ -448,7 +447,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
|
|||||||
BOOST_THROW_EXCEPTION(ScriptError("Function is not marked as safe for sandbox mode.", m_DebugInfo));
|
BOOST_THROW_EXCEPTION(ScriptError("Function is not marked as safe for sandbox mode.", m_DebugInfo));
|
||||||
|
|
||||||
std::vector<Value> arguments;
|
std::vector<Value> arguments;
|
||||||
BOOST_FOREACH(Expression *arg, m_Args) {
|
for (Expression *arg : m_Args) {
|
||||||
ExpressionResult argres = arg->Evaluate(frame);
|
ExpressionResult argres = arg->Evaluate(frame);
|
||||||
CHECK_RESULT(argres);
|
CHECK_RESULT(argres);
|
||||||
|
|
||||||
@ -462,7 +461,7 @@ ExpressionResult ArrayExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhin
|
|||||||
{
|
{
|
||||||
Array::Ptr result = new Array();
|
Array::Ptr result = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(Expression *aexpr, m_Expressions) {
|
for (Expression *aexpr : m_Expressions) {
|
||||||
ExpressionResult element = aexpr->Evaluate(frame);
|
ExpressionResult element = aexpr->Evaluate(frame);
|
||||||
CHECK_RESULT(element);
|
CHECK_RESULT(element);
|
||||||
|
|
||||||
@ -484,7 +483,7 @@ ExpressionResult DictExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint
|
|||||||
Value result;
|
Value result;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BOOST_FOREACH(Expression *aexpr, m_Expressions) {
|
for (Expression *aexpr : m_Expressions) {
|
||||||
ExpressionResult element = aexpr->Evaluate(frame, dhint);
|
ExpressionResult element = aexpr->Evaluate(frame, dhint);
|
||||||
CHECK_RESULT(element);
|
CHECK_RESULT(element);
|
||||||
result = element.GetValue();
|
result = element.GetValue();
|
||||||
@ -686,7 +685,7 @@ void icinga::BindToScope(Expression *& expr, ScopeSpecifier scopeSpec)
|
|||||||
DictExpression *dexpr = dynamic_cast<DictExpression *>(expr);
|
DictExpression *dexpr = dynamic_cast<DictExpression *>(expr);
|
||||||
|
|
||||||
if (dexpr) {
|
if (dexpr) {
|
||||||
BOOST_FOREACH(Expression *& expr, dexpr->m_Expressions)
|
for (Expression *& expr : dexpr->m_Expressions)
|
||||||
BindToScope(expr, scopeSpec);
|
BindToScope(expr, scopeSpec);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/scriptframe.hpp"
|
#include "base/scriptframe.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/thread/future.hpp>
|
#include <boost/thread/future.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -574,7 +573,7 @@ public:
|
|||||||
{
|
{
|
||||||
delete m_FName;
|
delete m_FName;
|
||||||
|
|
||||||
BOOST_FOREACH(Expression *expr, m_Args)
|
for (Expression *expr : m_Args)
|
||||||
delete expr;
|
delete expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,7 +594,7 @@ public:
|
|||||||
|
|
||||||
~ArrayExpression(void)
|
~ArrayExpression(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(Expression *expr, m_Expressions)
|
for (Expression *expr : m_Expressions)
|
||||||
delete expr;
|
delete expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +614,7 @@ public:
|
|||||||
|
|
||||||
~DictExpression(void)
|
~DictExpression(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(Expression *expr, m_Expressions)
|
for (Expression *expr : m_Expressions)
|
||||||
delete expr;
|
delete expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -806,7 +805,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_ClosedVars) {
|
if (m_ClosedVars) {
|
||||||
typedef std::pair<String, Expression *> kv_pair;
|
typedef std::pair<String, Expression *> kv_pair;
|
||||||
BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) {
|
for (const kv_pair& kv : *m_ClosedVars) {
|
||||||
delete kv.second;
|
delete kv.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -843,7 +842,7 @@ public:
|
|||||||
|
|
||||||
if (m_ClosedVars) {
|
if (m_ClosedVars) {
|
||||||
typedef std::pair<String, Expression *> kv_pair;
|
typedef std::pair<String, Expression *> kv_pair;
|
||||||
BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) {
|
for (const kv_pair& kv : *m_ClosedVars) {
|
||||||
delete kv.second;
|
delete kv.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -885,7 +884,7 @@ public:
|
|||||||
|
|
||||||
if (m_ClosedVars) {
|
if (m_ClosedVars) {
|
||||||
typedef std::pair<String, Expression *> kv_pair;
|
typedef std::pair<String, Expression *> kv_pair;
|
||||||
BOOST_FOREACH(const kv_pair& kv, *m_ClosedVars) {
|
for (const kv_pair& kv : *m_ClosedVars) {
|
||||||
delete kv.second;
|
delete kv.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "config/objectrule.hpp"
|
#include "config/objectrule.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/smart_ptr/make_shared.hpp>
|
#include <boost/smart_ptr/make_shared.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -49,7 +48,7 @@ public:
|
|||||||
Array::Ptr imports = ScriptFrame::GetImports();
|
Array::Ptr imports = ScriptFrame::GetImports();
|
||||||
|
|
||||||
ObjectLock olock(imports);
|
ObjectLock olock(imports);
|
||||||
BOOST_FOREACH(const Value& import, imports) {
|
for (const Value& import : imports) {
|
||||||
Object::Ptr obj = import;
|
Object::Ptr obj = import;
|
||||||
if (obj->HasOwnField(name)) {
|
if (obj->HasOwnField(name)) {
|
||||||
*result = import;
|
*result = import;
|
||||||
@ -192,12 +191,12 @@ public:
|
|||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(dict);
|
ObjectLock olock(dict);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, dict) {
|
for (const Dictionary::Pair& kv : dict) {
|
||||||
keys.push_back(kv.first);
|
keys.push_back(kv.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const String& key, keys) {
|
for (const String& key : keys) {
|
||||||
frame.Locals->Set(fkvar, key);
|
frame.Locals->Set(fkvar, key);
|
||||||
frame.Locals->Set(fvvar, dict->Get(key));
|
frame.Locals->Set(fvvar, dict->Get(key));
|
||||||
ExpressionResult res = expression->Evaluate(frame);
|
ExpressionResult res = expression->Evaluate(frame);
|
||||||
@ -256,7 +255,7 @@ private:
|
|||||||
locals = new Dictionary();
|
locals = new Dictionary();
|
||||||
|
|
||||||
typedef std::pair<String, Expression *> ClosedVar;
|
typedef std::pair<String, Expression *> ClosedVar;
|
||||||
BOOST_FOREACH(const ClosedVar& cvar, *closedVars) {
|
for (const ClosedVar& cvar : *closedVars) {
|
||||||
locals->Set(cvar.first, cvar.second->Evaluate(frame));
|
locals->Set(cvar.first, cvar.second->Evaluate(frame));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -466,13 +465,13 @@ void DbConnection::UpdateObject(const ConfigObject::Ptr& object)
|
|||||||
|
|
||||||
void DbConnection::UpdateAllObjects(void)
|
void DbConnection::UpdateAllObjects(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Type::Ptr& type, Type::GetAllTypes()) {
|
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
||||||
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
ConfigType *dtype = dynamic_cast<ConfigType *>(type.get());
|
||||||
|
|
||||||
if (!dtype)
|
if (!dtype)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOST_FOREACH(const ConfigObject::Ptr& object, dtype->GetObjects()) {
|
for (const ConfigObject::Ptr& object : dtype->GetObjects()) {
|
||||||
UpdateObject(object);
|
UpdateObject(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -480,7 +479,7 @@ void DbConnection::UpdateAllObjects(void)
|
|||||||
|
|
||||||
void DbConnection::PrepareDatabase(void)
|
void DbConnection::PrepareDatabase(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const DbType::Ptr& type, DbType::GetAllTypes()) {
|
for (const DbType::Ptr& type : DbType::GetAllTypes()) {
|
||||||
FillIDCache(type);
|
FillIDCache(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "icinga/externalcommandprocessor.hpp"
|
#include "icinga/externalcommandprocessor.hpp"
|
||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "icinga/icingaapplication.hpp"
|
#include "icinga/icingaapplication.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -203,7 +202,7 @@ void DbEvents::ReachabilityChangedHandler(const Checkable::Ptr& checkable, const
|
|||||||
Log(LogDebug, "DbEvents")
|
Log(LogDebug, "DbEvents")
|
||||||
<< "Updating reachability for checkable '" << checkable->GetName() << "': " << (is_reachable ? "" : "not" ) << " reachable for " << children.size() << " children.";
|
<< "Updating reachability for checkable '" << checkable->GetName() << "': " << (is_reachable ? "" : "not" ) << " reachable for " << children.size() << " children.";
|
||||||
|
|
||||||
BOOST_FOREACH(const Checkable::Ptr& child, children) {
|
for (const Checkable::Ptr& child : children) {
|
||||||
Log(LogDebug, "DbEvents")
|
Log(LogDebug, "DbEvents")
|
||||||
<< "Updating reachability for checkable '" << child->GetName() << "': " << (is_reachable ? "" : "not" ) << " reachable.";
|
<< "Updating reachability for checkable '" << child->GetName() << "': " << (is_reachable ? "" : "not" ) << " reachable.";
|
||||||
|
|
||||||
@ -305,7 +304,7 @@ void DbEvents::AddComments(const Checkable::Ptr& checkable)
|
|||||||
|
|
||||||
std::vector<DbQuery> queries;
|
std::vector<DbQuery> queries;
|
||||||
|
|
||||||
BOOST_FOREACH(const Comment::Ptr& comment, comments) {
|
for (const Comment::Ptr& comment : comments) {
|
||||||
AddCommentInternal(queries, comment, false);
|
AddCommentInternal(queries, comment, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +442,7 @@ void DbEvents::AddDowntimes(const Checkable::Ptr& checkable)
|
|||||||
|
|
||||||
std::vector<DbQuery> queries;
|
std::vector<DbQuery> queries;
|
||||||
|
|
||||||
BOOST_FOREACH(const Downtime::Ptr& downtime, downtimes) {
|
for (const Downtime::Ptr& downtime : downtimes) {
|
||||||
AddDowntimeInternal(queries, downtime, false);
|
AddDowntimeInternal(queries, downtime, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +874,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
|
|||||||
|
|
||||||
std::vector<DbQuery> queries;
|
std::vector<DbQuery> queries;
|
||||||
|
|
||||||
BOOST_FOREACH(const User::Ptr& user, users) {
|
for (const User::Ptr& user : users) {
|
||||||
Log(LogDebug, "DbEvents")
|
Log(LogDebug, "DbEvents")
|
||||||
<< "add contact notification history for service '" << checkable->GetName() << "' and user '" << user->GetName() << "'.";
|
<< "add contact notification history for service '" << checkable->GetName() << "' and user '" << user->GetName() << "'.";
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -92,7 +91,7 @@ String DbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) const
|
|||||||
{
|
{
|
||||||
ObjectLock olock(configFieldsDup);
|
ObjectLock olock(configFieldsDup);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, configFieldsDup) {
|
for (const Dictionary::Pair& kv : configFieldsDup) {
|
||||||
if (kv.second.IsObjectType<ConfigObject>()) {
|
if (kv.second.IsObjectType<ConfigObject>()) {
|
||||||
ConfigObject::Ptr obj = kv.second;
|
ConfigObject::Ptr obj = kv.second;
|
||||||
configFieldsDup->Set(kv.first, obj->GetName());
|
configFieldsDup->Set(kv.first, obj->GetName());
|
||||||
@ -235,7 +234,7 @@ void DbObject::SendVarsConfigUpdateHeavy(void)
|
|||||||
if (vars) {
|
if (vars) {
|
||||||
ObjectLock olock (vars);
|
ObjectLock olock (vars);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
|
for (const Dictionary::Pair& kv : vars) {
|
||||||
if (kv.first.IsEmpty())
|
if (kv.first.IsEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -284,7 +283,7 @@ void DbObject::SendVarsStatusUpdate(void)
|
|||||||
std::vector<DbQuery> queries;
|
std::vector<DbQuery> queries;
|
||||||
ObjectLock olock (vars);
|
ObjectLock olock (vars);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
|
for (const Dictionary::Pair& kv : vars) {
|
||||||
if (kv.first.IsEmpty())
|
if (kv.first.IsEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/debug.hpp"
|
#include "base/debug.hpp"
|
||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ DbType::Ptr DbType::GetByID(long tid)
|
|||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||||
|
|
||||||
BOOST_FOREACH(const TypeMap::value_type& kv, GetTypes()) {
|
for (const TypeMap::value_type& kv : GetTypes()) {
|
||||||
if (kv.second->GetTypeID() == tid)
|
if (kv.second->GetTypeID() == tid)
|
||||||
return kv.second;
|
return kv.second;
|
||||||
}
|
}
|
||||||
@ -142,10 +141,11 @@ std::set<DbType::Ptr> DbType::GetAllTypes(void)
|
|||||||
{
|
{
|
||||||
std::set<DbType::Ptr> result;
|
std::set<DbType::Ptr> result;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
{
|
||||||
std::pair<String, DbType::Ptr> kv;
|
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||||
BOOST_FOREACH(kv, GetTypes()) {
|
for (const auto& kv : GetTypes()) {
|
||||||
result.insert(kv.second);
|
result.insert(kv.second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -197,7 +196,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
BOOST_FOREACH(const String& groupName, groups) {
|
for (const String& groupName : groups) {
|
||||||
HostGroup::Ptr group = HostGroup::GetByName(groupName);
|
HostGroup::Ptr group = HostGroup::GetByName(groupName);
|
||||||
|
|
||||||
DbQuery query2;
|
DbQuery query2;
|
||||||
@ -231,7 +230,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
|
|||||||
queries.push_back(query2);
|
queries.push_back(query2);
|
||||||
|
|
||||||
/* parents */
|
/* parents */
|
||||||
BOOST_FOREACH(const Checkable::Ptr& checkable, host->GetParents()) {
|
for (const Checkable::Ptr& checkable : host->GetParents()) {
|
||||||
Host::Ptr parent = dynamic_pointer_cast<Host>(checkable);
|
Host::Ptr parent = dynamic_pointer_cast<Host>(checkable);
|
||||||
|
|
||||||
if (!parent)
|
if (!parent)
|
||||||
@ -272,7 +271,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
queries.push_back(query3);
|
queries.push_back(query3);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, host->GetDependencies()) {
|
for (const Dependency::Ptr& dep : host->GetDependencies()) {
|
||||||
Checkable::Ptr parent = dep->GetParent();
|
Checkable::Ptr parent = dep->GetParent();
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
@ -320,7 +319,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
queries.push_back(query4);
|
queries.push_back(query4);
|
||||||
|
|
||||||
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(host)) {
|
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(host)) {
|
||||||
Log(LogDebug, "HostDbObject")
|
Log(LogDebug, "HostDbObject")
|
||||||
<< "host contacts: " << user->GetName();
|
<< "host contacts: " << user->GetName();
|
||||||
|
|
||||||
@ -354,7 +353,7 @@ void HostDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
queries.push_back(query5);
|
queries.push_back(query5);
|
||||||
|
|
||||||
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(host)) {
|
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(host)) {
|
||||||
Log(LogDebug, "HostDbObject")
|
Log(LogDebug, "HostDbObject")
|
||||||
<< "host contactgroups: " << usergroup->GetName();
|
<< "host contactgroups: " << usergroup->GetName();
|
||||||
|
|
||||||
@ -405,7 +404,7 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
|
|||||||
Array::Ptr parents = new Array();
|
Array::Ptr parents = new Array();
|
||||||
|
|
||||||
/* parents */
|
/* parents */
|
||||||
BOOST_FOREACH(const Checkable::Ptr& checkable, host->GetParents()) {
|
for (const Checkable::Ptr& checkable : host->GetParents()) {
|
||||||
Host::Ptr parent = dynamic_pointer_cast<Host>(checkable);
|
Host::Ptr parent = dynamic_pointer_cast<Host>(checkable);
|
||||||
|
|
||||||
if (!parent)
|
if (!parent)
|
||||||
@ -421,7 +420,7 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
|
|||||||
Array::Ptr dependencies = new Array();
|
Array::Ptr dependencies = new Array();
|
||||||
|
|
||||||
/* dependencies */
|
/* dependencies */
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, host->GetDependencies()) {
|
for (const Dependency::Ptr& dep : host->GetDependencies()) {
|
||||||
Checkable::Ptr parent = dep->GetParent();
|
Checkable::Ptr parent = dep->GetParent();
|
||||||
|
|
||||||
if (!parent)
|
if (!parent)
|
||||||
@ -441,7 +440,7 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
|
|||||||
|
|
||||||
Array::Ptr users = new Array();
|
Array::Ptr users = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(host)) {
|
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(host)) {
|
||||||
users->Add(user->GetName());
|
users->Add(user->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +450,7 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
|
|||||||
|
|
||||||
Array::Ptr userGroups = new Array();
|
Array::Ptr userGroups = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(host)) {
|
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(host)) {
|
||||||
userGroups->Add(usergroup->GetName());
|
userGroups->Add(usergroup->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/configtype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/configtype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/json.hpp"
|
#include "base/json.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
@ -191,7 +190,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
BOOST_FOREACH(const String& groupName, groups) {
|
for (const String& groupName : groups) {
|
||||||
ServiceGroup::Ptr group = ServiceGroup::GetByName(groupName);
|
ServiceGroup::Ptr group = ServiceGroup::GetByName(groupName);
|
||||||
|
|
||||||
DbQuery query2;
|
DbQuery query2;
|
||||||
@ -228,7 +227,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
queries.push_back(query2);
|
queries.push_back(query2);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, service->GetDependencies()) {
|
for (const Dependency::Ptr& dep : service->GetDependencies()) {
|
||||||
Checkable::Ptr parent = dep->GetParent();
|
Checkable::Ptr parent = dep->GetParent();
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
@ -280,7 +279,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
queries.push_back(query3);
|
queries.push_back(query3);
|
||||||
|
|
||||||
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(service)) {
|
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(service)) {
|
||||||
Log(LogDebug, "ServiceDbObject")
|
Log(LogDebug, "ServiceDbObject")
|
||||||
<< "service contacts: " << user->GetName();
|
<< "service contacts: " << user->GetName();
|
||||||
|
|
||||||
@ -314,7 +313,7 @@ void ServiceDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
queries.push_back(query4);
|
queries.push_back(query4);
|
||||||
|
|
||||||
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(service)) {
|
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(service)) {
|
||||||
Log(LogDebug, "ServiceDbObject")
|
Log(LogDebug, "ServiceDbObject")
|
||||||
<< "service contactgroups: " << usergroup->GetName();
|
<< "service contactgroups: " << usergroup->GetName();
|
||||||
|
|
||||||
@ -365,7 +364,7 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
|
|||||||
Array::Ptr dependencies = new Array();
|
Array::Ptr dependencies = new Array();
|
||||||
|
|
||||||
/* dependencies */
|
/* dependencies */
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, service->GetDependencies()) {
|
for (const Dependency::Ptr& dep : service->GetDependencies()) {
|
||||||
Checkable::Ptr parent = dep->GetParent();
|
Checkable::Ptr parent = dep->GetParent();
|
||||||
|
|
||||||
if (!parent)
|
if (!parent)
|
||||||
@ -385,7 +384,7 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
|
|||||||
|
|
||||||
Array::Ptr users = new Array();
|
Array::Ptr users = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(service)) {
|
for (const User::Ptr& user : CompatUtility::GetCheckableNotificationUsers(service)) {
|
||||||
users->Add(user->GetName());
|
users->Add(user->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +394,7 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
|
|||||||
|
|
||||||
Array::Ptr userGroups = new Array();
|
Array::Ptr userGroups = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(service)) {
|
for (const UserGroup::Ptr& usergroup : CompatUtility::GetCheckableNotificationUserGroups(service)) {
|
||||||
userGroups->Add(usergroup->GetName());
|
userGroups->Add(usergroup->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "db_ido/dbvalue.hpp"
|
#include "db_ido/dbvalue.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ void TimePeriodDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
time_t refts = Utility::GetTime();
|
time_t refts = Utility::GetTime();
|
||||||
ObjectLock olock(ranges);
|
ObjectLock olock(ranges);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
|
for (const Dictionary::Pair& kv : ranges) {
|
||||||
int wday = LegacyTimePeriod::WeekdayFromString(kv.first);
|
int wday = LegacyTimePeriod::WeekdayFromString(kv.first);
|
||||||
|
|
||||||
if (wday == -1)
|
if (wday == -1)
|
||||||
@ -81,7 +80,7 @@ void TimePeriodDbObject::OnConfigUpdateHeavy(void)
|
|||||||
LegacyTimePeriod::ProcessTimeRanges(kv.second, &reference, segments);
|
LegacyTimePeriod::ProcessTimeRanges(kv.second, &reference, segments);
|
||||||
|
|
||||||
ObjectLock olock(segments);
|
ObjectLock olock(segments);
|
||||||
BOOST_FOREACH(const Value& vsegment, segments) {
|
for (const Value& vsegment : segments) {
|
||||||
Dictionary::Ptr segment = vsegment;
|
Dictionary::Ptr segment = vsegment;
|
||||||
int begin = segment->Get("begin");
|
int begin = segment->Get("begin");
|
||||||
int end = segment->Get("end");
|
int end = segment->Get("end");
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -100,7 +99,7 @@ void UserDbObject::OnConfigUpdateHeavy(void)
|
|||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
BOOST_FOREACH(const String& groupName, groups) {
|
for (const String& groupName : groups) {
|
||||||
UserGroup::Ptr group = UserGroup::GetByName(groupName);
|
UserGroup::Ptr group = UserGroup::GetByName(groupName);
|
||||||
|
|
||||||
DbQuery query2;
|
DbQuery query2;
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/initialize.hpp"
|
#include "base/initialize.hpp"
|
||||||
#include "base/configtype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ void IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const IdoMysqlConnection::Ptr& idomysqlconnection, ConfigType::GetObjectsByType<IdoMysqlConnection>()) {
|
for (const IdoMysqlConnection::Ptr& idomysqlconnection : ConfigType::GetObjectsByType<IdoMysqlConnection>()) {
|
||||||
size_t items = idomysqlconnection->m_QueryQueue.GetLength();
|
size_t items = idomysqlconnection->m_QueryQueue.GetLength();
|
||||||
|
|
||||||
Dictionary::Ptr stats = new Dictionary();
|
Dictionary::Ptr stats = new Dictionary();
|
||||||
@ -401,7 +400,7 @@ void IdoMysqlConnection::Reconnect(void)
|
|||||||
|
|
||||||
EnableActiveChangedHandler();
|
EnableActiveChangedHandler();
|
||||||
|
|
||||||
BOOST_FOREACH(const DbObject::Ptr& dbobj, activeDbObjs) {
|
for (const DbObject::Ptr& dbobj : activeDbObjs) {
|
||||||
if (dbobj->GetObject())
|
if (dbobj->GetObject())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -830,7 +829,7 @@ bool IdoMysqlConnection::CanExecuteQuery(const DbQuery& query)
|
|||||||
ObjectLock olock(query.WhereCriteria);
|
ObjectLock olock(query.WhereCriteria);
|
||||||
Value value;
|
Value value;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
|
for (const Dictionary::Pair& kv : query.WhereCriteria) {
|
||||||
if (!FieldToEscapedString(kv.first, kv.second, &value))
|
if (!FieldToEscapedString(kv.first, kv.second, &value))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -839,7 +838,7 @@ bool IdoMysqlConnection::CanExecuteQuery(const DbQuery& query)
|
|||||||
if (query.Fields) {
|
if (query.Fields) {
|
||||||
ObjectLock olock(query.Fields);
|
ObjectLock olock(query.Fields);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
|
for (const Dictionary::Pair& kv : query.Fields) {
|
||||||
Value value;
|
Value value;
|
||||||
|
|
||||||
if (kv.second.IsEmpty() && !kv.second.IsString())
|
if (kv.second.IsEmpty() && !kv.second.IsString())
|
||||||
@ -860,7 +859,7 @@ void IdoMysqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
|
|||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BOOST_FOREACH(const DbQuery& query, queries) {
|
for (const DbQuery& query : queries) {
|
||||||
ASSERT(query.Type == DbQueryNewTransaction || query.Category != DbCatInvalid);
|
ASSERT(query.Type == DbQueryNewTransaction || query.Category != DbCatInvalid);
|
||||||
|
|
||||||
if (!CanExecuteQuery(query)) {
|
if (!CanExecuteQuery(query)) {
|
||||||
@ -869,7 +868,7 @@ void IdoMysqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const DbQuery& query, queries) {
|
for (const DbQuery& query : queries) {
|
||||||
InternalExecuteQuery(query);
|
InternalExecuteQuery(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -909,7 +908,7 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
|
|||||||
Value value;
|
Value value;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
|
for (const Dictionary::Pair& kv : query.WhereCriteria) {
|
||||||
if (!FieldToEscapedString(kv.first, kv.second, &value)) {
|
if (!FieldToEscapedString(kv.first, kv.second, &value)) {
|
||||||
m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority);
|
m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority);
|
||||||
return;
|
return;
|
||||||
@ -976,7 +975,7 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
|
|||||||
ObjectLock olock(query.Fields);
|
ObjectLock olock(query.Fields);
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
|
for (const Dictionary::Pair& kv : query.Fields) {
|
||||||
Value value;
|
Value value;
|
||||||
|
|
||||||
if (kv.second.IsEmpty() && !kv.second.IsString())
|
if (kv.second.IsEmpty() && !kv.second.IsString())
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ void IdoPgsqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||||||
{
|
{
|
||||||
Dictionary::Ptr nodes = new Dictionary();
|
Dictionary::Ptr nodes = new Dictionary();
|
||||||
|
|
||||||
BOOST_FOREACH(const IdoPgsqlConnection::Ptr& idopgsqlconnection, ConfigType::GetObjectsByType<IdoPgsqlConnection>()) {
|
for (const IdoPgsqlConnection::Ptr& idopgsqlconnection : ConfigType::GetObjectsByType<IdoPgsqlConnection>()) {
|
||||||
size_t items = idopgsqlconnection->m_QueryQueue.GetLength();
|
size_t items = idopgsqlconnection->m_QueryQueue.GetLength();
|
||||||
|
|
||||||
Dictionary::Ptr stats = new Dictionary();
|
Dictionary::Ptr stats = new Dictionary();
|
||||||
@ -374,7 +373,7 @@ void IdoPgsqlConnection::Reconnect(void)
|
|||||||
|
|
||||||
EnableActiveChangedHandler();
|
EnableActiveChangedHandler();
|
||||||
|
|
||||||
BOOST_FOREACH(const DbObject::Ptr& dbobj, activeDbObjs) {
|
for (const DbObject::Ptr& dbobj : activeDbObjs) {
|
||||||
if (dbobj->GetObject())
|
if (dbobj->GetObject())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -687,7 +686,7 @@ bool IdoPgsqlConnection::CanExecuteQuery(const DbQuery& query)
|
|||||||
ObjectLock olock(query.WhereCriteria);
|
ObjectLock olock(query.WhereCriteria);
|
||||||
Value value;
|
Value value;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
|
for (const Dictionary::Pair& kv : query.WhereCriteria) {
|
||||||
if (!FieldToEscapedString(kv.first, kv.second, &value))
|
if (!FieldToEscapedString(kv.first, kv.second, &value))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -696,7 +695,7 @@ bool IdoPgsqlConnection::CanExecuteQuery(const DbQuery& query)
|
|||||||
if (query.Fields) {
|
if (query.Fields) {
|
||||||
ObjectLock olock(query.Fields);
|
ObjectLock olock(query.Fields);
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
|
for (const Dictionary::Pair& kv : query.Fields) {
|
||||||
Value value;
|
Value value;
|
||||||
|
|
||||||
if (kv.second.IsEmpty() && !kv.second.IsString())
|
if (kv.second.IsEmpty() && !kv.second.IsString())
|
||||||
@ -717,7 +716,7 @@ void IdoPgsqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
|
|||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BOOST_FOREACH(const DbQuery& query, queries) {
|
for (const DbQuery& query : queries) {
|
||||||
ASSERT(query.Type == DbQueryNewTransaction || query.Category != DbCatInvalid);
|
ASSERT(query.Type == DbQueryNewTransaction || query.Category != DbCatInvalid);
|
||||||
|
|
||||||
if (!CanExecuteQuery(query)) {
|
if (!CanExecuteQuery(query)) {
|
||||||
@ -726,7 +725,7 @@ void IdoPgsqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const DbQuery& query, queries) {
|
for (const DbQuery& query : queries) {
|
||||||
InternalExecuteQuery(query);
|
InternalExecuteQuery(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -766,7 +765,7 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
|
|||||||
Value value;
|
Value value;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, query.WhereCriteria) {
|
for (const Dictionary::Pair& kv : query.WhereCriteria) {
|
||||||
if (!FieldToEscapedString(kv.first, kv.second, &value)) {
|
if (!FieldToEscapedString(kv.first, kv.second, &value)) {
|
||||||
m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, -1), query.Priority);
|
m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, -1), query.Priority);
|
||||||
return;
|
return;
|
||||||
@ -834,7 +833,7 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
|
|||||||
|
|
||||||
Value value;
|
Value value;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, query.Fields) {
|
for (const Dictionary::Pair& kv : query.Fields) {
|
||||||
if (kv.second.IsEmpty() && !kv.second.IsString())
|
if (kv.second.IsEmpty() && !kv.second.IsString())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ Dictionary::Ptr ApiActions::DelayNotification(const ConfigObject::Ptr& object,
|
|||||||
if (!params->Contains("timestamp"))
|
if (!params->Contains("timestamp"))
|
||||||
return ApiActions::CreateResult(403, "A timestamp is required to delay notifications");
|
return ApiActions::CreateResult(403, "A timestamp is required to delay notifications");
|
||||||
|
|
||||||
BOOST_FOREACH(const Notification::Ptr& notification, checkable->GetNotifications()) {
|
for (const Notification::Ptr& notification : checkable->GetNotifications()) {
|
||||||
notification->SetNextNotification(HttpUtility::GetLastParameter(params, "timestamp"));
|
notification->SetNextNotification(HttpUtility::GetLastParameter(params, "timestamp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ Dictionary::Ptr ApiActions::RemoveComment(const ConfigObject::Ptr& object,
|
|||||||
if (checkable) {
|
if (checkable) {
|
||||||
std::set<Comment::Ptr> comments = checkable->GetComments();
|
std::set<Comment::Ptr> comments = checkable->GetComments();
|
||||||
|
|
||||||
BOOST_FOREACH(const Comment::Ptr& comment, comments) {
|
for (const Comment::Ptr& comment : comments) {
|
||||||
Comment::RemoveComment(comment->GetName());
|
Comment::RemoveComment(comment->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ Dictionary::Ptr ApiActions::RemoveDowntime(const ConfigObject::Ptr& object,
|
|||||||
if (checkable) {
|
if (checkable) {
|
||||||
std::set<Downtime::Ptr> downtimes = checkable->GetDowntimes();
|
std::set<Downtime::Ptr> downtimes = checkable->GetDowntimes();
|
||||||
|
|
||||||
BOOST_FOREACH(const Downtime::Ptr& downtime, downtimes) {
|
for (const Downtime::Ptr& downtime : downtimes) {
|
||||||
Downtime::RemoveDowntime(downtime->GetName(), true);
|
Downtime::RemoveDowntime(downtime->GetName(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ void ApiEvents::CheckResultHandler(const Checkable::Ptr& checkable, const CheckR
|
|||||||
|
|
||||||
result->Set("check_result", Serialize(cr));
|
result->Set("check_result", Serialize(cr));
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ void ApiEvents::StateChangeHandler(const Checkable::Ptr& checkable, const CheckR
|
|||||||
result->Set("state_type", checkable->GetStateType());
|
result->Set("state_type", checkable->GetStateType());
|
||||||
result->Set("check_result", Serialize(cr));
|
result->Set("check_result", Serialize(cr));
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ void ApiEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& notif
|
|||||||
|
|
||||||
Array::Ptr userNames = new Array();
|
Array::Ptr userNames = new Array();
|
||||||
|
|
||||||
BOOST_FOREACH(const User::Ptr& user, users) {
|
for (const User::Ptr& user : users) {
|
||||||
userNames->Add(user->GetName());
|
userNames->Add(user->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ void ApiEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& notif
|
|||||||
result->Set("text", text);
|
result->Set("text", text);
|
||||||
result->Set("check_result", Serialize(cr));
|
result->Set("check_result", Serialize(cr));
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ void ApiEvents::FlappingChangedHandler(const Checkable::Ptr& checkable, const Me
|
|||||||
result->Set("state_type", checkable->GetStateType());
|
result->Set("state_type", checkable->GetStateType());
|
||||||
result->Set("is_flapping", checkable->IsFlapping());
|
result->Set("is_flapping", checkable->IsFlapping());
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ void ApiEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
|||||||
result->Set("notify", notify);
|
result->Set("notify", notify);
|
||||||
result->Set("expiry", expiry);
|
result->Set("expiry", expiry);
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ void ApiEvents::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, c
|
|||||||
result->Set("state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
|
result->Set("state", service ? static_cast<int>(service->GetState()) : static_cast<int>(host->GetState()));
|
||||||
result->Set("state_type", checkable->GetStateType());
|
result->Set("state_type", checkable->GetStateType());
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ void ApiEvents::CommentAddedHandler(const Comment::Ptr& comment)
|
|||||||
|
|
||||||
result->Set("comment", Serialize(comment, FAConfig | FAState));
|
result->Set("comment", Serialize(comment, FAConfig | FAState));
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ void ApiEvents::CommentRemovedHandler(const Comment::Ptr& comment)
|
|||||||
|
|
||||||
result->Set("comment", Serialize(comment, FAConfig | FAState));
|
result->Set("comment", Serialize(comment, FAConfig | FAState));
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ void ApiEvents::DowntimeAddedHandler(const Downtime::Ptr& downtime)
|
|||||||
|
|
||||||
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
|
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,7 +318,7 @@ void ApiEvents::DowntimeRemovedHandler(const Downtime::Ptr& downtime)
|
|||||||
|
|
||||||
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
|
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ void ApiEvents::DowntimeTriggeredHandler(const Downtime::Ptr& downtime)
|
|||||||
|
|
||||||
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
|
result->Set("downtime", Serialize(downtime, FAConfig | FAState));
|
||||||
|
|
||||||
BOOST_FOREACH(const EventQueue::Ptr& queue, queues) {
|
for (const EventQueue::Ptr& queue : queues) {
|
||||||
queue->ProcessEvent(result);
|
queue->ProcessEvent(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -240,7 +239,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* reschedule direct parents */
|
/* reschedule direct parents */
|
||||||
BOOST_FOREACH(const Checkable::Ptr& parent, GetParents()) {
|
for (const Checkable::Ptr& parent : GetParents()) {
|
||||||
if (parent.get() == this)
|
if (parent.get() == this)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -24,21 +24,20 @@
|
|||||||
#include "base/timer.hpp"
|
#include "base/timer.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
|
||||||
void Checkable::RemoveAllComments(void)
|
void Checkable::RemoveAllComments(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Comment::Ptr& comment, GetComments()) {
|
for (const Comment::Ptr& comment : GetComments()) {
|
||||||
Comment::RemoveComment(comment->GetName());
|
Comment::RemoveComment(comment->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkable::RemoveCommentsByType(int type)
|
void Checkable::RemoveCommentsByType(int type)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Comment::Ptr& comment, GetComments()) {
|
for (const Comment::Ptr& comment : GetComments()) {
|
||||||
if (comment->GetEntryType() == type)
|
if (comment->GetEntryType() == type)
|
||||||
Comment::RemoveComment(comment->GetName());
|
Comment::RemoveComment(comment->GetName());
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "icinga/dependency.hpp"
|
#include "icinga/dependency.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Checkable::Ptr& checkable, GetParents()) {
|
for (const Checkable::Ptr& checkable : GetParents()) {
|
||||||
if (!checkable->IsReachable(dt, failedDependency, rstack + 1))
|
if (!checkable->IsReachable(dt, failedDependency, rstack + 1))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -87,7 +86,7 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, GetDependencies()) {
|
for (const Dependency::Ptr& dep : GetDependencies()) {
|
||||||
if (!dep->IsAvailable(dt)) {
|
if (!dep->IsAvailable(dt)) {
|
||||||
if (failedDependency)
|
if (failedDependency)
|
||||||
*failedDependency = dep;
|
*failedDependency = dep;
|
||||||
@ -106,7 +105,7 @@ std::set<Checkable::Ptr> Checkable::GetParents(void) const
|
|||||||
{
|
{
|
||||||
std::set<Checkable::Ptr> parents;
|
std::set<Checkable::Ptr> parents;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, GetDependencies()) {
|
for (const Dependency::Ptr& dep : GetDependencies()) {
|
||||||
Checkable::Ptr parent = dep->GetParent();
|
Checkable::Ptr parent = dep->GetParent();
|
||||||
|
|
||||||
if (parent && parent.get() != this)
|
if (parent && parent.get() != this)
|
||||||
@ -120,7 +119,7 @@ std::set<Checkable::Ptr> Checkable::GetChildren(void) const
|
|||||||
{
|
{
|
||||||
std::set<Checkable::Ptr> parents;
|
std::set<Checkable::Ptr> parents;
|
||||||
|
|
||||||
BOOST_FOREACH(const Dependency::Ptr& dep, GetReverseDependencies()) {
|
for (const Dependency::Ptr& dep : GetReverseDependencies()) {
|
||||||
Checkable::Ptr service = dep->GetChild();
|
Checkable::Ptr service = dep->GetChild();
|
||||||
|
|
||||||
if (service && service.get() != this)
|
if (service && service.get() != this)
|
||||||
|
@ -23,27 +23,26 @@
|
|||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
void Checkable::RemoveAllDowntimes(void)
|
void Checkable::RemoveAllDowntimes(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Downtime::Ptr& downtime, GetDowntimes()) {
|
for (const Downtime::Ptr& downtime : GetDowntimes()) {
|
||||||
Downtime::RemoveDowntime(downtime->GetName(), true, true);
|
Downtime::RemoveDowntime(downtime->GetName(), true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkable::TriggerDowntimes(void)
|
void Checkable::TriggerDowntimes(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Downtime::Ptr& downtime, GetDowntimes()) {
|
for (const Downtime::Ptr& downtime : GetDowntimes()) {
|
||||||
downtime->TriggerDowntime();
|
downtime->TriggerDowntime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Checkable::IsInDowntime(void) const
|
bool Checkable::IsInDowntime(void) const
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Downtime::Ptr& downtime, GetDowntimes()) {
|
for (const Downtime::Ptr& downtime : GetDowntimes()) {
|
||||||
if (downtime->IsInEffect())
|
if (downtime->IsInEffect())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -55,7 +54,7 @@ int Checkable::GetDowntimeDepth(void) const
|
|||||||
{
|
{
|
||||||
int downtime_depth = 0;
|
int downtime_depth = 0;
|
||||||
|
|
||||||
BOOST_FOREACH(const Downtime::Ptr& downtime, GetDowntimes()) {
|
for (const Downtime::Ptr& downtime : GetDowntimes()) {
|
||||||
if (downtime->IsInEffect())
|
if (downtime->IsInEffect())
|
||||||
downtime_depth++;
|
downtime_depth++;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "icinga/checkable.hpp"
|
#include "icinga/checkable.hpp"
|
||||||
#include "icinga/icingaapplication.hpp"
|
#include "icinga/icingaapplication.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/context.hpp"
|
#include "base/context.hpp"
|
||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ boost::signals2::signal<void (const Notification::Ptr&, const Checkable::Ptr&, c
|
|||||||
|
|
||||||
void Checkable::ResetNotificationNumbers(void)
|
void Checkable::ResetNotificationNumbers(void)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(const Notification::Ptr& notification, GetNotifications()) {
|
for (const Notification::Ptr& notification : GetNotifications()) {
|
||||||
ObjectLock olock(notification);
|
ObjectLock olock(notification);
|
||||||
notification->ResetNotificationNumber();
|
notification->ResetNotificationNumber();
|
||||||
}
|
}
|
||||||
@ -71,7 +70,7 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr&
|
|||||||
Log(LogDebug, "Checkable")
|
Log(LogDebug, "Checkable")
|
||||||
<< "Checkable '" << GetName() << "' has " << notifications.size() << " notification(s).";
|
<< "Checkable '" << GetName() << "' has " << notifications.size() << " notification(s).";
|
||||||
|
|
||||||
BOOST_FOREACH(const Notification::Ptr& notification, notifications) {
|
for (const Notification::Ptr& notification : notifications) {
|
||||||
try {
|
try {
|
||||||
if (!notification->IsPaused())
|
if (!notification->IsPaused())
|
||||||
notification->BeginExecuteNotification(type, cr, force, false, author, text);
|
notification->BeginExecuteNotification(type, cr, force, false, author, text);
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/bind/apply.hpp>
|
#include <boost/bind/apply.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
#include "base/configtype.hpp"
|
#include "base/configtype.hpp"
|
||||||
#include "base/statsfunction.hpp"
|
#include "base/statsfunction.hpp"
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
@ -82,7 +81,7 @@ CheckableCheckStatistics CIB::CalculateHostCheckStats(void)
|
|||||||
int count_execution_time = 0;
|
int count_execution_time = 0;
|
||||||
bool checkresult = false;
|
bool checkresult = false;
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
|
||||||
ObjectLock olock(host);
|
ObjectLock olock(host);
|
||||||
|
|
||||||
CheckResult::Ptr cr = host->GetLastCheckResult();
|
CheckResult::Ptr cr = host->GetLastCheckResult();
|
||||||
@ -143,7 +142,7 @@ CheckableCheckStatistics CIB::CalculateServiceCheckStats(void)
|
|||||||
int count_execution_time = 0;
|
int count_execution_time = 0;
|
||||||
bool checkresult = false;
|
bool checkresult = false;
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
for (const Service::Ptr& service : ConfigType::GetObjectsByType<Service>()) {
|
||||||
ObjectLock olock(service);
|
ObjectLock olock(service);
|
||||||
|
|
||||||
CheckResult::Ptr cr = service->GetLastCheckResult();
|
CheckResult::Ptr cr = service->GetLastCheckResult();
|
||||||
@ -200,7 +199,7 @@ ServiceStatistics CIB::CalculateServiceStats(void)
|
|||||||
{
|
{
|
||||||
ServiceStatistics ss = {};
|
ServiceStatistics ss = {};
|
||||||
|
|
||||||
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
for (const Service::Ptr& service : ConfigType::GetObjectsByType<Service>()) {
|
||||||
ObjectLock olock(service);
|
ObjectLock olock(service);
|
||||||
|
|
||||||
CheckResult::Ptr cr = service->GetLastCheckResult();
|
CheckResult::Ptr cr = service->GetLastCheckResult();
|
||||||
@ -234,7 +233,7 @@ HostStatistics CIB::CalculateHostStats(void)
|
|||||||
{
|
{
|
||||||
HostStatistics hs = {};
|
HostStatistics hs = {};
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
for (const Host::Ptr& host : ConfigType::GetObjectsByType<Host>()) {
|
||||||
ObjectLock olock(host);
|
ObjectLock olock(host);
|
||||||
|
|
||||||
if (host->IsReachable()) {
|
if (host->IsReachable()) {
|
||||||
@ -269,13 +268,8 @@ std::pair<Dictionary::Ptr, Array::Ptr> CIB::GetFeatureStats(void)
|
|||||||
Array::Ptr perfdata = new Array();
|
Array::Ptr perfdata = new Array();
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
BOOST_FOREACH(tie(name, boost::tuples::ignore), StatsFunctionRegistry::GetInstance()->GetItems()) {
|
for (const auto& kv : StatsFunctionRegistry::GetInstance()->GetItems()) {
|
||||||
StatsFunction::Ptr func = StatsFunctionRegistry::GetInstance()->GetItem(name);
|
kv.second->Invoke(status, perfdata);
|
||||||
|
|
||||||
if (!func)
|
|
||||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Function '" + name + "' does not exist."));
|
|
||||||
|
|
||||||
func->Invoke(status, perfdata);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_pair(status, perfdata);
|
return std::make_pair(status, perfdata);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user