Move Certificate install in resotre path to DEBUG
We are seeing 387+ `Certificate install` messages for a single boot in
the journal log.
Moved the `Certifacte install` log for the restore path to DEBUG instead
of INFO to remove it on the normal jorunal logs.
Tested:
```
systemctl status phosphor-certificate-manager@bmcweb.service
* phosphor-certificate-manager@bmcweb.service - Phosphor certificate manager for bmcweb
Loaded: loaded (/lib/systemd/system/phosphor-certificate-manager@.service; static)
Active: active (running) since Fri 2018-03-09 19:19:02 UTC; 24s ago
Main PID: 25773 (phosphor-certif)
CGroup: /system.slice/system-phosphor\x2dcertificate\x2dmanager.slice/phosphor-certificate-manager@bmcweb.service
`-25773 /usr/bin/phosphor-certificate-manager --endpoint https --path /path/server.pem --type server --unit server_creds.target
Mar 09 19:19:02 [hostname] systemd[1]: Started Phosphor certificate manager for bmcweb.
Mar 09 19:19:03 [hostname] phosphor-certificate-manager[25773]: Error occurred during X509_verify_cert call, checking for known error
Mar 09 19:19:03 [hostname] phosphor-certificate-manager[25773]: Certificate compareKeys
Mar 09 19:19:03 [hostname] phosphor-certificate-manager[25773]: Certificate install
...
```
Change-Id: I907afd6ce4522e5c54348d16c1ace0a770f3b8f1
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/certificate.cpp b/certificate.cpp
index bf20845..9628b55 100644
--- a/certificate.cpp
+++ b/certificate.cpp
@@ -231,7 +231,7 @@
Certificate::Certificate(sdbusplus::bus_t& bus, const std::string& objPath,
CertificateType type, const std::string& installPath,
const std::string& uploadPath, Watch* watch,
- Manager& parent) :
+ Manager& parent, bool restore) :
internal::CertificateInterface(
bus, objPath.c_str(),
internal::CertificateInterface::action::defer_emit),
@@ -261,7 +261,7 @@
certFilePath = generateCertFilePath(uploadPath);
// install the certificate
- install(uploadPath);
+ install(uploadPath, restore);
this->emit_object_added();
}
@@ -270,7 +270,7 @@
const CertificateType& type,
const std::string& installPath, X509_STORE& x509Store,
const std::string& pem, Watch* watchPtr,
- Manager& parent) :
+ Manager& parent, bool restore) :
internal::CertificateInterface(
bus, objPath.c_str(),
internal::CertificateInterface::action::defer_emit),
@@ -281,7 +281,7 @@
certFilePath = generateUniqueFilePath(installPath);
// install the certificate
- install(x509Store, pem);
+ install(x509Store, pem, restore);
this->emit_object_added();
}
@@ -300,10 +300,18 @@
manager.replaceCertificate(this, filePath);
}
-void Certificate::install(const std::string& certSrcFilePath)
+void Certificate::install(const std::string& certSrcFilePath, bool restore)
{
- log<level::INFO>("Certificate install ",
- entry("FILEPATH=%s", certSrcFilePath.c_str()));
+ if (restore)
+ {
+ log<level::DEBUG>("Certificate install ",
+ entry("FILEPATH=%s", certSrcFilePath.c_str()));
+ }
+ else
+ {
+ log<level::INFO>("Certificate install ",
+ entry("FILEPATH=%s", certSrcFilePath.c_str()));
+ }
// stop watch for user initiated certificate install
if (certWatch != nullptr)
@@ -388,9 +396,19 @@
}
}
-void Certificate::install(X509_STORE& x509Store, const std::string& pem)
+void Certificate::install(X509_STORE& x509Store, const std::string& pem,
+ bool restore)
{
- log<level::INFO>("Certificate install ", entry("PEM_STR=%s", pem.data()));
+ if (restore)
+ {
+ log<level::DEBUG>("Certificate install ",
+ entry("PEM_STR=%s", pem.data()));
+ }
+ else
+ {
+ log<level::INFO>("Certificate install ",
+ entry("PEM_STR=%s", pem.data()));
+ }
if (certType != CertificateType::authority)
{