diff --git a/lib/cli/nodesetupcommand.cpp b/lib/cli/nodesetupcommand.cpp index 80a38b060..4107661cc 100644 --- a/lib/cli/nodesetupcommand.cpp +++ b/lib/cli/nodesetupcommand.cpp @@ -254,15 +254,15 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v fp.close(); #ifdef _WIN32 - _unlink(apipath.CStr()); + _unlink(apipath.CStr()); #endif /* _WIN32 */ - if (rename(apipathtmp.CStr(), apipath.CStr()) < 0) { - BOOST_THROW_EXCEPTION(posix_error() - << boost::errinfo_api_function("rename") - << boost::errinfo_errno(errno) - << boost::errinfo_file_name(apipathtmp)); - } + if (rename(apipathtmp.CStr(), apipath.CStr()) < 0) { + BOOST_THROW_EXCEPTION(posix_error() + << boost::errinfo_api_function("rename") + << boost::errinfo_errno(errno) + << boost::errinfo_file_name(apipathtmp)); + } /* update constants.conf with NodeName = CN + TicketSalt = random value */ if (cn != Utility::GetFQDN()) { @@ -463,15 +463,15 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm, fp.close(); #ifdef _WIN32 - _unlink(apipath.CStr()); + _unlink(apipath.CStr()); #endif /* _WIN32 */ - if (rename(apipathtmp.CStr(), apipath.CStr()) < 0) { - BOOST_THROW_EXCEPTION(posix_error() - << boost::errinfo_api_function("rename") - << boost::errinfo_errno(errno) - << boost::errinfo_file_name(apipathtmp)); - } + if (rename(apipathtmp.CStr(), apipath.CStr()) < 0) { + BOOST_THROW_EXCEPTION(posix_error() + << boost::errinfo_api_function("rename") + << boost::errinfo_errno(errno) + << boost::errinfo_file_name(apipathtmp)); + } /* generate local zones.conf with zone+endpoint */ diff --git a/lib/cli/nodeutility.cpp b/lib/cli/nodeutility.cpp index 5588f62ae..0e04ed994 100644 --- a/lib/cli/nodeutility.cpp +++ b/lib/cli/nodeutility.cpp @@ -63,11 +63,11 @@ void NodeUtility::CreateRepositoryPath(const String& path) Utility::MkDirP(path, 0750); String user = ScriptGlobal::Get("RunAsUser"); - String group = ScriptGlobal::Get("RunAsGroup"); + String group = ScriptGlobal::Get("RunAsGroup"); - if (!Utility::SetFileOwnership(path, user, group)) { - Log(LogWarning, "cli") - << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; + if (!Utility::SetFileOwnership(path, user, group)) { + Log(LogWarning, "cli") + << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; } } @@ -195,7 +195,7 @@ void NodeUtility::RemoveNode(const String& name) << boost::errinfo_api_function("unlink") << boost::errinfo_errno(errno) << boost::errinfo_file_name(repoPath)); - } + } String settingsPath = GetNodeSettingsFile(name); @@ -376,20 +376,20 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt Utility::MkDirP(path, 0755); String user = ScriptGlobal::Get("RunAsUser"); - String group = ScriptGlobal::Get("RunAsGroup"); + String group = ScriptGlobal::Get("RunAsGroup"); - if (!Utility::SetFileOwnership(path, user, group)) { - Log(LogWarning, "cli") - << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; + if (!Utility::SetFileOwnership(path, user, group)) { + Log(LogWarning, "cli") + << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; } - if (!Utility::SetFileOwnership(filename, user, group)) { - Log(LogWarning, "cli") - << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; + if (!Utility::SetFileOwnership(filename, user, group)) { + Log(LogWarning, "cli") + << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; } String tempPath = filename + ".tmp"; - std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc); + std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc); fp << "/*\n"; fp << " * Generated by Icinga 2 node setup commands\n"; @@ -405,7 +405,7 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt } fp << std::endl; - fp.close(); + fp.close(); #ifdef _WIN32 _unlink(filename.CStr()); @@ -614,56 +614,56 @@ bool NodeUtility::CreateBackupFile(const String& target) void NodeUtility::SerializeObject(std::ostream& fp, const String& name, const String& type, const Dictionary::Ptr& object) { - fp << "object " << type << " \"" << name << "\" {\n"; + fp << "object " << type << " \"" << name << "\" {\n"; ObjectLock olock(object); - BOOST_FOREACH(const Dictionary::Pair& kv, object) { + BOOST_FOREACH(const Dictionary::Pair& kv, object) { if (kv.first == "__type" || kv.first == "__name") continue; - fp << "\t" << kv.first << " = "; - FormatValue(fp, kv.second); - fp << "\n"; - } - fp << "}\n\n"; + fp << "\t" << kv.first << " = "; + FormatValue(fp, kv.second); + fp << "\n"; + } + fp << "}\n\n"; } void NodeUtility::FormatValue(std::ostream& fp, const Value& val) { - if (val.IsObjectType()) { - FormatArray(fp, val); - return; - } + if (val.IsObjectType()) { + FormatArray(fp, val); + return; + } - if (val.IsString()) { - fp << "\"" << Convert::ToString(val) << "\""; - return; - } + if (val.IsString()) { + fp << "\"" << Convert::ToString(val) << "\""; + return; + } - fp << Convert::ToString(val); + fp << Convert::ToString(val); } void NodeUtility::FormatArray(std::ostream& fp, const Array::Ptr& arr) { - bool first = true; + bool first = true; - fp << "[ "; + fp << "[ "; - if (arr) { - ObjectLock olock(arr); - BOOST_FOREACH(const Value& value, arr) { - if (first) - first = false; - else - fp << ", "; + if (arr) { + ObjectLock olock(arr); + BOOST_FOREACH(const Value& value, arr) { + if (first) + first = false; + else + fp << ", "; - FormatValue(fp, value); - } - } + FormatValue(fp, value); + } + } - if (!first) - fp << " "; + if (!first) + fp << " "; - fp << "]"; + fp << "]"; } void NodeUtility::UpdateConstant(const String& name, const String& value) diff --git a/lib/cli/pkiutility.cpp b/lib/cli/pkiutility.cpp index 7f5944b53..e39ae52bd 100644 --- a/lib/cli/pkiutility.cpp +++ b/lib/cli/pkiutility.cpp @@ -148,9 +148,9 @@ int PkiUtility::SaveCert(const String& host, const String& port, const String& k sslContext = MakeSSLContext(certfile, keyfile); } catch (const std::exception& ex) { Log(LogCritical, "cli") - << "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "'."; + << "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "'."; Log(LogDebug, "cli") - << "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "':\n" << DiagnosticInformation(ex); + << "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "':\n" << DiagnosticInformation(ex); return 1; } @@ -209,9 +209,9 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const sslContext = MakeSSLContext(certfile, keyfile); } catch (const std::exception& ex) { Log(LogCritical, "cli") - << "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "' ca path: '" << cafile << "'."; + << "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "' ca path: '" << cafile << "'."; Log(LogDebug, "cli") - << "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "' ca path: '" << cafile << "':\n" << DiagnosticInformation(ex); + << "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "' ca path: '" << cafile << "':\n" << DiagnosticInformation(ex); return 1; } @@ -232,7 +232,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const trustedCert = GetX509Certificate(trustedfile); } catch (const std::exception&) { Log(LogCritical, "cli") - << "Cannot get trusted from cert path: '" << trustedfile << "'."; + << "Cannot get trusted from cert path: '" << trustedfile << "'."; return 1; } diff --git a/lib/cli/repositoryclearchangescommand.hpp b/lib/cli/repositoryclearchangescommand.hpp index ac4332e48..7157e153a 100644 --- a/lib/cli/repositoryclearchangescommand.hpp +++ b/lib/cli/repositoryclearchangescommand.hpp @@ -36,12 +36,12 @@ namespace icinga class RepositoryClearChangesCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(RepositoryClearChangesCommand); + DECLARE_PTR_TYPEDEFS(RepositoryClearChangesCommand); - virtual String GetDescription(void) const; - virtual String GetShortDescription(void) const; + virtual String GetDescription(void) const; + virtual String GetShortDescription(void) const; virtual ImpersonationLevel GetImpersonationLevel(void) const; - virtual int Run(const boost::program_options::variables_map& vm, const std::vector& ap) const; + virtual int Run(const boost::program_options::variables_map& vm, const std::vector& ap) const; }; } diff --git a/lib/cli/repositorycommitcommand.hpp b/lib/cli/repositorycommitcommand.hpp index d853d25e1..239b616f3 100644 --- a/lib/cli/repositorycommitcommand.hpp +++ b/lib/cli/repositorycommitcommand.hpp @@ -36,14 +36,14 @@ namespace icinga class RepositoryCommitCommand : public CLICommand { public: - DECLARE_PTR_TYPEDEFS(RepositoryCommitCommand); + DECLARE_PTR_TYPEDEFS(RepositoryCommitCommand); - virtual String GetDescription(void) const; - virtual String GetShortDescription(void) const; - virtual void InitParameters(boost::program_options::options_description& visibleDesc, - boost::program_options::options_description& hiddenDesc) const; + virtual String GetDescription(void) const; + virtual String GetShortDescription(void) const; + virtual void InitParameters(boost::program_options::options_description& visibleDesc, + boost::program_options::options_description& hiddenDesc) const; virtual ImpersonationLevel GetImpersonationLevel(void) const; - virtual int Run(const boost::program_options::variables_map& vm, const std::vector& ap) const; + virtual int Run(const boost::program_options::variables_map& vm, const std::vector& ap) const; }; } diff --git a/lib/cli/repositoryutility.cpp b/lib/cli/repositoryutility.cpp index c1604c6f9..644ff8ebb 100644 --- a/lib/cli/repositoryutility.cpp +++ b/lib/cli/repositoryutility.cpp @@ -131,11 +131,11 @@ void RepositoryUtility::CreateRepositoryPath(const String& path) Utility::MkDirP(path, 0750); String user = ScriptGlobal::Get("RunAsUser"); - String group = ScriptGlobal::Get("RunAsGroup"); + String group = ScriptGlobal::Get("RunAsGroup"); - if (!Utility::SetFileOwnership(path, user, group)) { - Log(LogWarning, "cli") - << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; + if (!Utility::SetFileOwnership(path, user, group)) { + Log(LogWarning, "cli") + << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; } } @@ -371,9 +371,9 @@ bool RepositoryUtility::WriteObjectToRepositoryChangeLog(const String& path, con String tempPath = path + ".tmp"; - std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc); - fp << JsonEncode(item); - fp.close(); + std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc); + fp << JsonEncode(item); + fp.close(); #ifdef _WIN32 _unlink(path.CStr()); @@ -511,10 +511,10 @@ bool RepositoryUtility::WriteObjectToRepository(const String& path, const String String tempPath = path + ".tmp"; - std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc); - SerializeObject(fp, name, type, item); + std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc); + SerializeObject(fp, name, type, item); fp << std::endl; - fp.close(); + fp.close(); #ifdef _WIN32 _unlink(path.CStr()); @@ -726,39 +726,39 @@ void RepositoryUtility::SerializeObject(std::ostream& fp, const String& name, co void RepositoryUtility::FormatValue(std::ostream& fp, const Value& val) { - if (val.IsObjectType()) { - FormatArray(fp, val); - return; - } + if (val.IsObjectType()) { + FormatArray(fp, val); + return; + } - if (val.IsString()) { - fp << "\"" << Convert::ToString(val) << "\""; - return; - } + if (val.IsString()) { + fp << "\"" << Convert::ToString(val) << "\""; + return; + } - fp << Convert::ToString(val); + fp << Convert::ToString(val); } void RepositoryUtility::FormatArray(std::ostream& fp, const Array::Ptr& arr) { - bool first = true; + bool first = true; - fp << "[ "; + fp << "[ "; - if (arr) { - ObjectLock olock(arr); - BOOST_FOREACH(const Value& value, arr) { - if (first) - first = false; - else - fp << ", "; + if (arr) { + ObjectLock olock(arr); + BOOST_FOREACH(const Value& value, arr) { + if (first) + first = false; + else + fp << ", "; - FormatValue(fp, value); - } - } + FormatValue(fp, value); + } + } - if (!first) - fp << " "; + if (!first) + fp << " "; - fp << "]"; + fp << "]"; } diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index 2837dbebe..a32163fdd 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -154,8 +154,8 @@ do { \ } <> { - BOOST_THROW_EXCEPTION(ScriptError("End-of-file while in comment", *yylloc)); - } + BOOST_THROW_EXCEPTION(ScriptError("End-of-file while in comment", *yylloc)); + } \/\/[^\n]* /* ignore C++-style comments */ diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index 7f85ad776..9d06fbdee 100644 --- a/lib/db_ido_mysql/idomysqlconnection.cpp +++ b/lib/db_ido_mysql/idomysqlconnection.cpp @@ -373,7 +373,7 @@ IdoMysqlResult IdoMysqlConnection::Query(const String& query) BOOST_THROW_EXCEPTION( database_error() - << errinfo_message(mysql_error(&m_Connection)) + << errinfo_message(mysql_error(&m_Connection)) << errinfo_database_query(query) ); }