blob: dbc1e374da57336eaa1f37e97f4926c999ced0ef [file] [log] [blame]
Jayanth Othayothcfbc8dc2018-09-03 07:22:27 -05001#include "certs_manager.hpp"
2
Marri Devender Rao6ceec402019-02-01 03:15:19 -06003#include <phosphor-logging/elog-errors.hpp>
4#include <xyz/openbmc_project/Certs/Install/error.hpp>
Jayanth Othayothcfbc8dc2018-09-03 07:22:27 -05005#include <xyz/openbmc_project/Common/error.hpp>
6
7namespace phosphor
8{
9namespace certs
10{
11
Jayanth Othayothcfbc8dc2018-09-03 07:22:27 -050012using InternalFailure =
13 sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
Marri Devender Rao6ceec402019-02-01 03:15:19 -060014using Reason = xyz::openbmc_project::Certs::Install::InvalidCertificate::REASON;
Jayanth Othayothcfbc8dc2018-09-03 07:22:27 -050015
Marri Devender Rao6ceec402019-02-01 03:15:19 -060016/** @brief Constructor to put object onto bus at a dbus path.
17 * @param[in] bus - Bus to attach to.
18 * @param[in] path - Path to attach at.
19 * @param[in] type - Type of the certificate.
20 * @param[in] unit - Unit consumed by this certificate.
21 * @param[in] installPath - Certificate installation path.
22 */
23Manager::Manager(sdbusplus::bus::bus& bus, const char* path,
24 const CertificateType& type, UnitsToRestart&& unit,
25 CertInstallPath&& installPath) :
26 Ifaces(bus, path),
27 bus(bus), objectPath(path), certType(type), unitToRestart(std::move(unit)),
28 certInstallPath(std::move(installPath))
Jayanth Othayothcfbc8dc2018-09-03 07:22:27 -050029{
Jayanth Othayothcfbc8dc2018-09-03 07:22:27 -050030}
31
Marri Devender Rao6ceec402019-02-01 03:15:19 -060032void Manager::install(const std::string filePath)
Jayanth Othayothcfbc8dc2018-09-03 07:22:27 -050033{
Jayanth Othayoth589159f2018-09-28 08:32:39 -050034}
Deepak Kodihalliae70b3d2018-09-30 05:42:00 -050035
36void Manager::delete_()
37{
Marri Devender Rao6ceec402019-02-01 03:15:19 -060038 // TODO: #Issue 4 when a certificate is deleted system auto generates
39 // certificate file. At present we are not supporting creation of
40 // certificate object for the auto-generated certificate file as
41 // deletion if only applicable for REST server and Bmcweb does not allow
42 // deletion of certificates
43 if (certificatePtr != nullptr)
Deepak Kodihalliae70b3d2018-09-30 05:42:00 -050044 {
Marri Devender Rao6ceec402019-02-01 03:15:19 -060045 certificatePtr.reset(nullptr);
Deepak Kodihalliae70b3d2018-09-30 05:42:00 -050046 }
47}
Jayanth Othayothcfbc8dc2018-09-03 07:22:27 -050048} // namespace certs
49} // namespace phosphor