mirror of https://github.com/Icinga/icinga2.git
parent
674badd3ce
commit
fa1d633484
|
@ -258,7 +258,7 @@ void ConfigObject::RestoreAttribute(const String& attr, bool updateVersion)
|
||||||
Value current = newValue;
|
Value current = newValue;
|
||||||
|
|
||||||
if (current.IsEmpty())
|
if (current.IsEmpty())
|
||||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot restore non-existing object attribute"));
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot restore non-existent object attribute"));
|
||||||
|
|
||||||
String prefix = tokens[0];
|
String prefix = tokens[0];
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void ConfigObject::RestoreAttribute(const String& attr, bool updateVersion)
|
||||||
prefix += "." + key;
|
prefix += "." + key;
|
||||||
|
|
||||||
if (!dict->Contains(key))
|
if (!dict->Contains(key))
|
||||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot restore non-existing object attribute"));
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot restore non-existent object attribute"));
|
||||||
|
|
||||||
current = dict->Get(key);
|
current = dict->Get(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ bool ApiSetupUtility::SetupMasterCertificates(const String& cn)
|
||||||
|
|
||||||
if (Utility::PathExists(key)) {
|
if (Utility::PathExists(key)) {
|
||||||
Log(LogInformation, "cli")
|
Log(LogInformation, "cli")
|
||||||
<< "Private key file '" << key << "' already existing, skipping.";
|
<< "Private key file '" << key << "' already exists, not generating new certificate.";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ bool ApiSetupUtility::SetupMasterApiUser(void)
|
||||||
|
|
||||||
if (Utility::PathExists(apiuserspath)) {
|
if (Utility::PathExists(apiuserspath)) {
|
||||||
Log(LogInformation, "cli")
|
Log(LogInformation, "cli")
|
||||||
<< "API user config file '" << apiuserspath << "' already existing, skipping.";
|
<< "API user config file '" << apiuserspath << "' already exists, not creating config file.";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v
|
||||||
|
|
||||||
if (Utility::PathExists(existing_path)) {
|
if (Utility::PathExists(existing_path)) {
|
||||||
Log(LogWarning, "cli")
|
Log(LogWarning, "cli")
|
||||||
<< "Certificate '" << existing_path << "' for CN '" << cn << "' already existing. Skipping certificate generation.";
|
<< "Certificate '" << existing_path << "' for CN '" << cn << "' already exists. Not generating new certificate.";
|
||||||
} else {
|
} else {
|
||||||
Log(LogInformation, "cli")
|
Log(LogInformation, "cli")
|
||||||
<< "Certificates not yet generated. Running 'api setup' now.";
|
<< "Certificates not yet generated. Running 'api setup' now.";
|
||||||
|
|
|
@ -256,7 +256,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
||||||
BOOST_FOREACH(const String& object_path, object_paths) {
|
BOOST_FOREACH(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 existing. Skipping its creation.";
|
<< "Host '" << host << "' already exists.";
|
||||||
skip_host = true;
|
skip_host = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
||||||
if (NodeUtility::CheckAgainstBlackAndWhiteList("blacklist", node_name, host, Empty) &&
|
if (NodeUtility::CheckAgainstBlackAndWhiteList("blacklist", node_name, host, Empty) &&
|
||||||
!NodeUtility::CheckAgainstBlackAndWhiteList("whitelist", node_name, host, Empty)) {
|
!NodeUtility::CheckAgainstBlackAndWhiteList("whitelist", node_name, host, Empty)) {
|
||||||
Log(LogWarning, "cli")
|
Log(LogWarning, "cli")
|
||||||
<< "Host '" << host << "' on node '" << node_name << "' is blacklisted, but not whitelisted. Skipping.";
|
<< "Host '" << host << "' on node '" << node_name << "' is blacklisted, but not whitelisted. Not creating host object.";
|
||||||
skip_host = true;
|
skip_host = true;
|
||||||
host_was_blacklisted = true; //check this for services on this blacklisted host
|
host_was_blacklisted = true; //check this for services on this blacklisted host
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
||||||
BOOST_FOREACH(const String& object_path, object_paths) {
|
BOOST_FOREACH(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 existing. Skipping its creation.";
|
<< "Service '" << service << "' on Host '" << host << "' already exists.";
|
||||||
skip_service = true;
|
skip_service = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ int NodeUpdateConfigCommand::Run(const boost::program_options::variables_map& vm
|
||||||
!NodeUtility::CheckAgainstBlackAndWhiteList("whitelist", endpoint, host, service)) {
|
!NodeUtility::CheckAgainstBlackAndWhiteList("whitelist", endpoint, host, service)) {
|
||||||
Log(LogWarning, "cli")
|
Log(LogWarning, "cli")
|
||||||
<< "Service '" << service << "' on host '" << host << "' on node '"
|
<< "Service '" << service << "' on host '" << host << "' on node '"
|
||||||
<< node_name << "' is blacklisted, but not whitelisted. Skipping.";
|
<< node_name << "' is blacklisted, but not whitelisted. Not creating service object.";
|
||||||
skip_service = true;
|
skip_service = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ int PkiUtility::NewCa(void)
|
||||||
|
|
||||||
if (Utility::PathExists(caCertFile) && Utility::PathExists(caKeyFile)) {
|
if (Utility::PathExists(caCertFile) && Utility::PathExists(caKeyFile)) {
|
||||||
Log(LogCritical, "cli")
|
Log(LogCritical, "cli")
|
||||||
<< "CA files '" << caCertFile << "' and '" << caKeyFile << "'already exist.";
|
<< "CA files '" << caCertFile << "' and '" << caKeyFile << "' already exist.";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -612,18 +612,15 @@ void RepositoryUtility::CommitChange(const Dictionary::Ptr& change, const String
|
||||||
String command = change->Get("command");
|
String command = change->Get("command");
|
||||||
Dictionary::Ptr attrs;
|
Dictionary::Ptr attrs;
|
||||||
|
|
||||||
if (change->Contains("attrs")) {
|
if (change->Contains("attrs"))
|
||||||
attrs = change->Get("attrs");
|
attrs = change->Get("attrs");
|
||||||
}
|
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
if (command == "add") {
|
if (command == "add")
|
||||||
success = AddObjectInternal(name, type, attrs);
|
success = AddObjectInternal(name, type, attrs);
|
||||||
}
|
else if (command == "remove")
|
||||||
else if (command == "remove") {
|
|
||||||
success = RemoveObjectInternal(name, type, attrs);
|
success = RemoveObjectInternal(name, type, attrs);
|
||||||
}
|
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
Log(LogNotice, "cli")
|
Log(LogNotice, "cli")
|
||||||
|
|
|
@ -240,7 +240,7 @@ Value ApiListener::ConfigDeleteObjectAPIHandler(const MessageOrigin::Ptr& origin
|
||||||
|
|
||||||
if (!object) {
|
if (!object) {
|
||||||
Log(LogNotice, "ApiListener")
|
Log(LogNotice, "ApiListener")
|
||||||
<< "Could not delete non-existing object '" << params->Get("name") << "'.";
|
<< "Could not delete non-existent object '" << params->Get("name") << "'.";
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ String ConfigPackageUtility::CreateStage(const String& packageName, const Dictio
|
||||||
Log(LogInformation, "ConfigPackageUtility")
|
Log(LogInformation, "ConfigPackageUtility")
|
||||||
<< "Updating configuration file: " << filePath;
|
<< "Updating configuration file: " << filePath;
|
||||||
|
|
||||||
//pass the directory and generate a dir tree, if not existing already
|
// Pass the directory and generate a dir tree, if it does not already exist
|
||||||
Utility::MkDirP(Utility::DirName(filePath), 0750);
|
Utility::MkDirP(Utility::DirName(filePath), 0750);
|
||||||
std::ofstream fp(filePath.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
|
std::ofstream fp(filePath.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
|
||||||
fp << kv.second;
|
fp << kv.second;
|
||||||
|
|
Loading…
Reference in New Issue