Merge pull request #8044 from Icinga/bugfix/catch-exception-in-node-setup-v2114

Catch exception when trusted cert is not readable during node setup on agent/satellite
This commit is contained in:
Noah Hilverling 2020-06-09 14:02:32 +02:00 committed by GitHub
commit 3628d7ffa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -373,7 +373,15 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm,
return 1;
}
trustedParentCert = GetX509Certificate(vm["trustedcert"].as<std::string>());
String trustedCert = vm["trustedcert"].as<std::string>();
try{
trustedParentCert = GetX509Certificate(trustedCert);
} catch (const std::exception&) {
Log(LogCritical, "cli")
<< "Can't read trusted cert at '" << trustedCert << "'.";
return 1;
}
Log(LogInformation, "cli")
<< "Verifying trusted certificate file '" << vm["trustedcert"].as<std::string>() << "'.";