Jayanth Othayoth | cfbc8dc | 2018-09-03 07:22:27 -0500 | [diff] [blame] | 1 | #include "certs_manager.hpp" |
| 2 | |
Marri Devender Rao | 6ceec40 | 2019-02-01 03:15:19 -0600 | [diff] [blame^] | 3 | #include <phosphor-logging/elog-errors.hpp> |
| 4 | #include <xyz/openbmc_project/Certs/Install/error.hpp> |
Jayanth Othayoth | cfbc8dc | 2018-09-03 07:22:27 -0500 | [diff] [blame] | 5 | #include <xyz/openbmc_project/Common/error.hpp> |
| 6 | |
| 7 | namespace phosphor |
| 8 | { |
| 9 | namespace certs |
| 10 | { |
| 11 | |
Jayanth Othayoth | cfbc8dc | 2018-09-03 07:22:27 -0500 | [diff] [blame] | 12 | using InternalFailure = |
| 13 | sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; |
Marri Devender Rao | 6ceec40 | 2019-02-01 03:15:19 -0600 | [diff] [blame^] | 14 | using Reason = xyz::openbmc_project::Certs::Install::InvalidCertificate::REASON; |
Jayanth Othayoth | cfbc8dc | 2018-09-03 07:22:27 -0500 | [diff] [blame] | 15 | |
Marri Devender Rao | 6ceec40 | 2019-02-01 03:15:19 -0600 | [diff] [blame^] | 16 | /** @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 | */ |
| 23 | Manager::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 Othayoth | cfbc8dc | 2018-09-03 07:22:27 -0500 | [diff] [blame] | 29 | { |
Jayanth Othayoth | cfbc8dc | 2018-09-03 07:22:27 -0500 | [diff] [blame] | 30 | } |
| 31 | |
Marri Devender Rao | 6ceec40 | 2019-02-01 03:15:19 -0600 | [diff] [blame^] | 32 | void Manager::install(const std::string filePath) |
Jayanth Othayoth | cfbc8dc | 2018-09-03 07:22:27 -0500 | [diff] [blame] | 33 | { |
Jayanth Othayoth | 589159f | 2018-09-28 08:32:39 -0500 | [diff] [blame] | 34 | } |
Deepak Kodihalli | ae70b3d | 2018-09-30 05:42:00 -0500 | [diff] [blame] | 35 | |
| 36 | void Manager::delete_() |
| 37 | { |
Marri Devender Rao | 6ceec40 | 2019-02-01 03:15:19 -0600 | [diff] [blame^] | 38 | // 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 Kodihalli | ae70b3d | 2018-09-30 05:42:00 -0500 | [diff] [blame] | 44 | { |
Marri Devender Rao | 6ceec40 | 2019-02-01 03:15:19 -0600 | [diff] [blame^] | 45 | certificatePtr.reset(nullptr); |
Deepak Kodihalli | ae70b3d | 2018-09-30 05:42:00 -0500 | [diff] [blame] | 46 | } |
| 47 | } |
Jayanth Othayoth | cfbc8dc | 2018-09-03 07:22:27 -0500 | [diff] [blame] | 48 | } // namespace certs |
| 49 | } // namespace phosphor |