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();
#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 */

View File

@ -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<Array>()) {
FormatArray(fp, val);
return;
}
if (val.IsObjectType<Array>()) {
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)

View File

@ -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;
}

View File

@ -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<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
{
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<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);
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<Array>()) {
FormatArray(fp, val);
return;
}
if (val.IsObjectType<Array>()) {
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 << "]";
}

View File

@ -154,8 +154,8 @@ do { \
}
<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 */

View File

@ -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)
);
}