Replace spaces with tabs

This commit is contained in:
Gunnar Beutner 2014-12-18 16:55:45 +01:00
parent 9f18211ada
commit 6383da1f2f
8 changed files with 111 additions and 111 deletions

View File

@ -254,15 +254,15 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
fp.close(); fp.close();
#ifdef _WIN32 #ifdef _WIN32
_unlink(apipath.CStr()); _unlink(apipath.CStr());
#endif /* _WIN32 */ #endif /* _WIN32 */
if (rename(apipathtmp.CStr(), apipath.CStr()) < 0) { if (rename(apipathtmp.CStr(), apipath.CStr()) < 0) {
BOOST_THROW_EXCEPTION(posix_error() BOOST_THROW_EXCEPTION(posix_error()
<< boost::errinfo_api_function("rename") << boost::errinfo_api_function("rename")
<< boost::errinfo_errno(errno) << boost::errinfo_errno(errno)
<< boost::errinfo_file_name(apipathtmp)); << boost::errinfo_file_name(apipathtmp));
} }
/* update constants.conf with NodeName = CN + TicketSalt = random value */ /* update constants.conf with NodeName = CN + TicketSalt = random value */
if (cn != Utility::GetFQDN()) { if (cn != Utility::GetFQDN()) {
@ -463,15 +463,15 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
fp.close(); fp.close();
#ifdef _WIN32 #ifdef _WIN32
_unlink(apipath.CStr()); _unlink(apipath.CStr());
#endif /* _WIN32 */ #endif /* _WIN32 */
if (rename(apipathtmp.CStr(), apipath.CStr()) < 0) { if (rename(apipathtmp.CStr(), apipath.CStr()) < 0) {
BOOST_THROW_EXCEPTION(posix_error() BOOST_THROW_EXCEPTION(posix_error()
<< boost::errinfo_api_function("rename") << boost::errinfo_api_function("rename")
<< boost::errinfo_errno(errno) << boost::errinfo_errno(errno)
<< boost::errinfo_file_name(apipathtmp)); << boost::errinfo_file_name(apipathtmp));
} }
/* generate local zones.conf with zone+endpoint */ /* generate local zones.conf with zone+endpoint */

View File

@ -63,11 +63,11 @@ void NodeUtility::CreateRepositoryPath(const String& path)
Utility::MkDirP(path, 0750); Utility::MkDirP(path, 0750);
String user = ScriptGlobal::Get("RunAsUser"); String user = ScriptGlobal::Get("RunAsUser");
String group = ScriptGlobal::Get("RunAsGroup"); String group = ScriptGlobal::Get("RunAsGroup");
if (!Utility::SetFileOwnership(path, user, group)) { if (!Utility::SetFileOwnership(path, user, group)) {
Log(LogWarning, "cli") Log(LogWarning, "cli")
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; << "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_api_function("unlink")
<< boost::errinfo_errno(errno) << boost::errinfo_errno(errno)
<< boost::errinfo_file_name(repoPath)); << boost::errinfo_file_name(repoPath));
} }
String settingsPath = GetNodeSettingsFile(name); String settingsPath = GetNodeSettingsFile(name);
@ -376,20 +376,20 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt
Utility::MkDirP(path, 0755); Utility::MkDirP(path, 0755);
String user = ScriptGlobal::Get("RunAsUser"); String user = ScriptGlobal::Get("RunAsUser");
String group = ScriptGlobal::Get("RunAsGroup"); String group = ScriptGlobal::Get("RunAsGroup");
if (!Utility::SetFileOwnership(path, user, group)) { if (!Utility::SetFileOwnership(path, user, group)) {
Log(LogWarning, "cli") Log(LogWarning, "cli")
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!";
} }
if (!Utility::SetFileOwnership(filename, user, group)) { if (!Utility::SetFileOwnership(filename, user, group)) {
Log(LogWarning, "cli") Log(LogWarning, "cli")
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; << "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!";
} }
String tempPath = filename + ".tmp"; 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 << "/*\n";
fp << " * Generated by Icinga 2 node setup commands\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 << std::endl;
fp.close(); fp.close();
#ifdef _WIN32 #ifdef _WIN32
_unlink(filename.CStr()); _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) 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); ObjectLock olock(object);
BOOST_FOREACH(const Dictionary::Pair& kv, object) { BOOST_FOREACH(const Dictionary::Pair& kv, object) {
if (kv.first == "__type" || kv.first == "__name") if (kv.first == "__type" || kv.first == "__name")
continue; continue;
fp << "\t" << kv.first << " = "; fp << "\t" << kv.first << " = ";
FormatValue(fp, kv.second); FormatValue(fp, kv.second);
fp << "\n"; fp << "\n";
} }
fp << "}\n\n"; fp << "}\n\n";
} }
void NodeUtility::FormatValue(std::ostream& fp, const Value& val) void NodeUtility::FormatValue(std::ostream& fp, const Value& val)
{ {
if (val.IsObjectType<Array>()) { if (val.IsObjectType<Array>()) {
FormatArray(fp, val); FormatArray(fp, val);
return; return;
} }
if (val.IsString()) { if (val.IsString()) {
fp << "\"" << Convert::ToString(val) << "\""; fp << "\"" << Convert::ToString(val) << "\"";
return; return;
} }
fp << Convert::ToString(val); fp << Convert::ToString(val);
} }
void NodeUtility::FormatArray(std::ostream& fp, const Array::Ptr& arr) void NodeUtility::FormatArray(std::ostream& fp, const Array::Ptr& arr)
{ {
bool first = true; bool first = true;
fp << "[ "; fp << "[ ";
if (arr) { if (arr) {
ObjectLock olock(arr); ObjectLock olock(arr);
BOOST_FOREACH(const Value& value, arr) { BOOST_FOREACH(const Value& value, arr) {
if (first) if (first)
first = false; first = false;
else else
fp << ", "; fp << ", ";
FormatValue(fp, value); FormatValue(fp, value);
} }
} }
if (!first) if (!first)
fp << " "; fp << " ";
fp << "]"; fp << "]";
} }
void NodeUtility::UpdateConstant(const String& name, const String& value) void NodeUtility::UpdateConstant(const String& name, const String& value)

View File

@ -148,9 +148,9 @@ int PkiUtility::SaveCert(const String& host, const String& port, const String& k
sslContext = MakeSSLContext(certfile, keyfile); sslContext = MakeSSLContext(certfile, keyfile);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Log(LogCritical, "cli") 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") 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; return 1;
} }
@ -209,9 +209,9 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
sslContext = MakeSSLContext(certfile, keyfile); sslContext = MakeSSLContext(certfile, keyfile);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Log(LogCritical, "cli") 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") 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; return 1;
} }
@ -232,7 +232,7 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
trustedCert = GetX509Certificate(trustedfile); trustedCert = GetX509Certificate(trustedfile);
} catch (const std::exception&) { } catch (const std::exception&) {
Log(LogCritical, "cli") Log(LogCritical, "cli")
<< "Cannot get trusted from cert path: '" << trustedfile << "'."; << "Cannot get trusted from cert path: '" << trustedfile << "'.";
return 1; return 1;
} }

View File

@ -36,12 +36,12 @@ namespace icinga
class RepositoryClearChangesCommand : public CLICommand class RepositoryClearChangesCommand : public CLICommand
{ {
public: public:
DECLARE_PTR_TYPEDEFS(RepositoryClearChangesCommand); DECLARE_PTR_TYPEDEFS(RepositoryClearChangesCommand);
virtual String GetDescription(void) const; virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const; virtual String GetShortDescription(void) const;
virtual ImpersonationLevel GetImpersonationLevel(void) const; virtual ImpersonationLevel GetImpersonationLevel(void) const;
virtual int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const; virtual int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const;
}; };
} }

View File

@ -36,14 +36,14 @@ namespace icinga
class RepositoryCommitCommand : public CLICommand class RepositoryCommitCommand : public CLICommand
{ {
public: public:
DECLARE_PTR_TYPEDEFS(RepositoryCommitCommand); DECLARE_PTR_TYPEDEFS(RepositoryCommitCommand);
virtual String GetDescription(void) const; virtual String GetDescription(void) const;
virtual String GetShortDescription(void) const; virtual String GetShortDescription(void) const;
virtual void InitParameters(boost::program_options::options_description& visibleDesc, virtual void InitParameters(boost::program_options::options_description& visibleDesc,
boost::program_options::options_description& hiddenDesc) const; boost::program_options::options_description& hiddenDesc) const;
virtual ImpersonationLevel GetImpersonationLevel(void) const; virtual ImpersonationLevel GetImpersonationLevel(void) const;
virtual int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const; virtual int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const;
}; };
} }

View File

@ -131,11 +131,11 @@ void RepositoryUtility::CreateRepositoryPath(const String& path)
Utility::MkDirP(path, 0750); Utility::MkDirP(path, 0750);
String user = ScriptGlobal::Get("RunAsUser"); String user = ScriptGlobal::Get("RunAsUser");
String group = ScriptGlobal::Get("RunAsGroup"); String group = ScriptGlobal::Get("RunAsGroup");
if (!Utility::SetFileOwnership(path, user, group)) { if (!Utility::SetFileOwnership(path, user, group)) {
Log(LogWarning, "cli") Log(LogWarning, "cli")
<< "Cannot set ownership for user '" << user << "' group '" << group << "' on path '" << path << "'. Verify it yourself!"; << "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"; String tempPath = path + ".tmp";
std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc); std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc);
fp << JsonEncode(item); fp << JsonEncode(item);
fp.close(); fp.close();
#ifdef _WIN32 #ifdef _WIN32
_unlink(path.CStr()); _unlink(path.CStr());
@ -511,10 +511,10 @@ bool RepositoryUtility::WriteObjectToRepository(const String& path, const String
String tempPath = path + ".tmp"; String tempPath = path + ".tmp";
std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc); std::ofstream fp(tempPath.CStr(), std::ofstream::out | std::ostream::trunc);
SerializeObject(fp, name, type, item); SerializeObject(fp, name, type, item);
fp << std::endl; fp << std::endl;
fp.close(); fp.close();
#ifdef _WIN32 #ifdef _WIN32
_unlink(path.CStr()); _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) void RepositoryUtility::FormatValue(std::ostream& fp, const Value& val)
{ {
if (val.IsObjectType<Array>()) { if (val.IsObjectType<Array>()) {
FormatArray(fp, val); FormatArray(fp, val);
return; return;
} }
if (val.IsString()) { if (val.IsString()) {
fp << "\"" << Convert::ToString(val) << "\""; fp << "\"" << Convert::ToString(val) << "\"";
return; return;
} }
fp << Convert::ToString(val); fp << Convert::ToString(val);
} }
void RepositoryUtility::FormatArray(std::ostream& fp, const Array::Ptr& arr) void RepositoryUtility::FormatArray(std::ostream& fp, const Array::Ptr& arr)
{ {
bool first = true; bool first = true;
fp << "[ "; fp << "[ ";
if (arr) { if (arr) {
ObjectLock olock(arr); ObjectLock olock(arr);
BOOST_FOREACH(const Value& value, arr) { BOOST_FOREACH(const Value& value, arr) {
if (first) if (first)
first = false; first = false;
else else
fp << ", "; fp << ", ";
FormatValue(fp, value); FormatValue(fp, value);
} }
} }
if (!first) if (!first)
fp << " "; fp << " ";
fp << "]"; fp << "]";
} }

View File

@ -154,8 +154,8 @@ do { \
} }
<C_COMMENT><<EOF>> { <C_COMMENT><<EOF>> {
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 */ \/\/[^\n]* /* ignore C++-style comments */

View File

@ -373,7 +373,7 @@ IdoMysqlResult IdoMysqlConnection::Query(const String& query)
BOOST_THROW_EXCEPTION( BOOST_THROW_EXCEPTION(
database_error() database_error()
<< errinfo_message(mysql_error(&m_Connection)) << errinfo_message(mysql_error(&m_Connection))
<< errinfo_database_query(query) << errinfo_database_query(query)
); );
} }