From 43699ca702068934add136309f28fa427c0d88e6 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Wed, 17 Oct 2018 14:56:29 -0500 Subject: Rename Version::Errors to Image::Errors The Version interface is a public interface, and errors are being added to it: https://gerrit.openbmc-project.xyz/#/c/openbmc/phosphor-dbus-interfaces/+/13836/ This conflicts with the internal Version errors, so rename the internal one to an Image namespace since that's not a public interface and make more sense since the errors deal with failures during image file extraction. Tested: Uploaded an invalid tar file (u-boot.bin) and the new Image::Error was created: "/xyz/openbmc_project/logging/entry/2": { "AdditionalData": [ "PATH=/tmp/images/u-boot.bin", "_PID=1348" ], "Description": "An internal BMC error occurred", "EventID": "None", "Id": 2, "Message": "xyz.openbmc_project.Software.Image.Error.UnTarFailure", Change-Id: I6f6c84e2ea782c8ebc952bba4d5cee6be232f08f Signed-off-by: Adriana Kobylak --- Makefile.am | 12 +++---- elog-errors.hpp | 42 +++++++++++----------- image_manager.cpp | 10 +++--- item_updater.cpp | 4 +-- xyz/openbmc_project/Software/Image.errors.yaml | 6 ++++ xyz/openbmc_project/Software/Image.metadata.yaml | 15 ++++++++ xyz/openbmc_project/Software/Version.errors.yaml | 6 ---- xyz/openbmc_project/Software/Version.metadata.yaml | 15 -------- 8 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 xyz/openbmc_project/Software/Image.errors.yaml create mode 100644 xyz/openbmc_project/Software/Image.metadata.yaml delete mode 100644 xyz/openbmc_project/Software/Version.errors.yaml delete mode 100644 xyz/openbmc_project/Software/Version.metadata.yaml diff --git a/Makefile.am b/Makefile.am index 3373fcb..f2042c2 100755 --- a/Makefile.am +++ b/Makefile.am @@ -24,8 +24,8 @@ phosphor_version_software_manager_SOURCES = \ image_manager.cpp BUILT_SOURCES = \ - xyz/openbmc_project/Software/Version/error.cpp \ - xyz/openbmc_project/Software/Version/error.hpp \ + xyz/openbmc_project/Software/Image/error.cpp \ + xyz/openbmc_project/Software/Image/error.hpp \ org/openbmc/Associations/server.cpp \ org/openbmc/Associations/server.hpp @@ -88,13 +88,13 @@ generic_ldflags = \ -lssl \ -lcrypto -xyz/openbmc_project/Software/Version/error.hpp: ${top_srcdir}/xyz/openbmc_project/Software/Version.errors.yaml +xyz/openbmc_project/Software/Image/error.hpp: ${top_srcdir}/xyz/openbmc_project/Software/Image.errors.yaml @mkdir -p `dirname $@` - $(SDBUSPLUSPLUS) -r $(srcdir) error exception-header xyz.openbmc_project.Software.Version > $@ + $(SDBUSPLUSPLUS) -r $(srcdir) error exception-header xyz.openbmc_project.Software.Image > $@ -xyz/openbmc_project/Software/Version/error.cpp: ${top_srcdir}/xyz/openbmc_project/Software/Version.errors.yaml +xyz/openbmc_project/Software/Image/error.cpp: ${top_srcdir}/xyz/openbmc_project/Software/Image.errors.yaml @mkdir -p `dirname $@` - $(SDBUSPLUSPLUS) -r $(srcdir) error exception-cpp xyz.openbmc_project.Software.Version > $@ + $(SDBUSPLUSPLUS) -r $(srcdir) error exception-cpp xyz.openbmc_project.Software.Image > $@ org/openbmc/Associations/server.cpp: org/openbmc/Associations.interface.yaml @mkdir -p `dirname $@` diff --git a/elog-errors.hpp b/elog-errors.hpp index a175849..2888f0d 100644 --- a/elog-errors.hpp +++ b/elog-errors.hpp @@ -17,13 +17,13 @@ namespace openbmc_project { namespace Software { -namespace Version +namespace Image { namespace Error { struct UnTarFailure; } // namespace Error -} // namespace Version +} // namespace Image } // namespace Software } // namespace openbmc_project } // namespace xyz @@ -37,13 +37,13 @@ namespace openbmc_project { namespace Software { -namespace Version +namespace Image { namespace Error { struct InternalFailure; } // namespace Error -} // namespace Version +} // namespace Image } // namespace Software } // namespace openbmc_project } // namespace xyz @@ -57,13 +57,13 @@ namespace openbmc_project { namespace Software { -namespace Version +namespace Image { namespace Error { struct ManifestFileFailure; } // namespace Error -} // namespace Version +} // namespace Image } // namespace Software } // namespace openbmc_project } // namespace xyz @@ -81,7 +81,7 @@ namespace openbmc_project { namespace Software { -namespace Version +namespace Image { namespace _UnTarFailure { @@ -100,7 +100,7 @@ struct PATH struct UnTarFailure : public sdbusplus::exception_t { static constexpr auto errName = - "xyz.openbmc_project.Software.Version.UnTarFailure"; + "xyz.openbmc_project.Software.Image.UnTarFailure"; static constexpr auto errDesc = "An error occurred during untar."; static constexpr auto L = level::ERR; using PATH = _UnTarFailure::PATH; @@ -122,7 +122,7 @@ struct UnTarFailure : public sdbusplus::exception_t } }; -} // namespace Version +} // namespace Image } // namespace Software } // namespace openbmc_project } // namespace xyz @@ -132,9 +132,9 @@ namespace details template <> struct map_exception_type< - sdbusplus::xyz::openbmc_project::Software::Version::Error::UnTarFailure> + sdbusplus::xyz::openbmc_project::Software::Image::Error::UnTarFailure> { - using type = xyz::openbmc_project::Software::Version::UnTarFailure; + using type = xyz::openbmc_project::Software::Image::UnTarFailure; }; } // namespace details @@ -144,7 +144,7 @@ namespace openbmc_project { namespace Software { -namespace Version +namespace Image { namespace _ManifestFileFailure { @@ -163,7 +163,7 @@ struct PATH struct ManifestFileFailure : public sdbusplus::exception_t { static constexpr auto errName = - "xyz.openbmc_project.Software.Version.ManifestFileFailure"; + "xyz.openbmc_project.Software.Image.ManifestFileFailure"; static constexpr auto errDesc = "An error when reading the Manifest file."; static constexpr auto L = level::ERR; using PATH = _ManifestFileFailure::PATH; @@ -185,7 +185,7 @@ struct ManifestFileFailure : public sdbusplus::exception_t } }; -} // namespace Version +} // namespace Image } // namespace Software } // namespace openbmc_project } // namespace xyz @@ -194,10 +194,10 @@ namespace details { template <> -struct map_exception_type { - using type = xyz::openbmc_project::Software::Version::ManifestFileFailure; + using type = xyz::openbmc_project::Software::Image::ManifestFileFailure; }; } // namespace details @@ -207,7 +207,7 @@ namespace openbmc_project { namespace Software { -namespace Version +namespace Image { namespace _InternalFailure { @@ -226,7 +226,7 @@ struct FAIL struct InternalFailure : public sdbusplus::exception_t { static constexpr auto errName = - "xyz.openbmc_project.Software.Version.InternalFailure"; + "xyz.openbmc_project.Software.Image.InternalFailure"; static constexpr auto errDesc = "The operation failed internally during processing the image."; static constexpr auto L = level::ERR; @@ -249,7 +249,7 @@ struct InternalFailure : public sdbusplus::exception_t } }; -} // namespace Version +} // namespace Image } // namespace Software } // namespace openbmc_project } // namespace xyz @@ -259,9 +259,9 @@ namespace details template <> struct map_exception_type< - sdbusplus::xyz::openbmc_project::Software::Version::Error::InternalFailure> + sdbusplus::xyz::openbmc_project::Software::Image::Error::InternalFailure> { - using type = xyz::openbmc_project::Software::Version::InternalFailure; + using type = xyz::openbmc_project::Software::Image::InternalFailure; }; } // namespace details diff --git a/image_manager.cpp b/image_manager.cpp index 8bae16c..1a530de 100644 --- a/image_manager.cpp +++ b/image_manager.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace phosphor { @@ -28,11 +28,11 @@ namespace manager { using namespace phosphor::logging; -using namespace sdbusplus::xyz::openbmc_project::Software::Version::Error; +using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; namespace Software = phosphor::logging::xyz::openbmc_project::Software; -using ManifestFail = Software::Version::ManifestFileFailure; -using UnTarFail = Software::Version::UnTarFailure; -using InternalFail = Software::Version::InternalFailure; +using ManifestFail = Software::Image::ManifestFileFailure; +using UnTarFail = Software::Image::UnTarFailure; +using InternalFail = Software::Image::InternalFailure; namespace fs = std::experimental::filesystem; struct RemovablePath diff --git a/item_updater.cpp b/item_updater.cpp index 90a97d4..6dd7a52 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace phosphor { @@ -29,7 +29,7 @@ namespace server = sdbusplus::xyz::openbmc_project::Software::server; namespace control = sdbusplus::xyz::openbmc_project::Control::server; using namespace phosphor::logging; -using namespace sdbusplus::xyz::openbmc_project::Software::Version::Error; +using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; using namespace phosphor::software::image; namespace fs = std::experimental::filesystem; diff --git a/xyz/openbmc_project/Software/Image.errors.yaml b/xyz/openbmc_project/Software/Image.errors.yaml new file mode 100644 index 0000000..67d6c20 --- /dev/null +++ b/xyz/openbmc_project/Software/Image.errors.yaml @@ -0,0 +1,6 @@ +- name: UnTarFailure + description: An error occurred during untar. +- name: ManifestFileFailure + description: An error when reading the Manifest file. +- name: InternalFailure + description: The operation failed internally during processing the image. diff --git a/xyz/openbmc_project/Software/Image.metadata.yaml b/xyz/openbmc_project/Software/Image.metadata.yaml new file mode 100644 index 0000000..5e749c9 --- /dev/null +++ b/xyz/openbmc_project/Software/Image.metadata.yaml @@ -0,0 +1,15 @@ +- name: UnTarFailure + level: ERR + meta: + - str: "PATH=%s" + type: string +- name: ManifestFileFailure + level: ERR + meta: + - str: "PATH=%s" + type: string +- name: InternalFailure + level: ERR + meta: + - str: "FAIL=%s" + type: string diff --git a/xyz/openbmc_project/Software/Version.errors.yaml b/xyz/openbmc_project/Software/Version.errors.yaml deleted file mode 100644 index 67d6c20..0000000 --- a/xyz/openbmc_project/Software/Version.errors.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- name: UnTarFailure - description: An error occurred during untar. -- name: ManifestFileFailure - description: An error when reading the Manifest file. -- name: InternalFailure - description: The operation failed internally during processing the image. diff --git a/xyz/openbmc_project/Software/Version.metadata.yaml b/xyz/openbmc_project/Software/Version.metadata.yaml deleted file mode 100644 index 5e749c9..0000000 --- a/xyz/openbmc_project/Software/Version.metadata.yaml +++ /dev/null @@ -1,15 +0,0 @@ -- name: UnTarFailure - level: ERR - meta: - - str: "PATH=%s" - type: string -- name: ManifestFileFailure - level: ERR - meta: - - str: "PATH=%s" - type: string -- name: InternalFailure - level: ERR - meta: - - str: "FAIL=%s" - type: string -- cgit v1.2.1