diff options
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/include/utils/chassis_utils.hpp | 3 | ||||
-rw-r--r-- | redfish-core/lib/health.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/hypervisor_system.hpp | 5 | ||||
-rw-r--r-- | redfish-core/lib/power.hpp | 10 | ||||
-rw-r--r-- | redfish-core/lib/processor.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/sensors.hpp | 3 |
6 files changed, 12 insertions, 13 deletions
diff --git a/redfish-core/include/utils/chassis_utils.hpp b/redfish-core/include/utils/chassis_utils.hpp index 0acbf33b7a..b7f16d83d0 100644 --- a/redfish-core/include/utils/chassis_utils.hpp +++ b/redfish-core/include/utils/chassis_utils.hpp @@ -35,11 +35,10 @@ void getValidChassisPath(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, } std::optional<std::string> chassisPath; - std::string chassisName; for (const std::string& chassis : chassisPaths) { sdbusplus::message::object_path path(chassis); - chassisName = path.filename(); + std::string chassisName = path.filename(); if (chassisName.empty()) { BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis; diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp index 2f0f156ae0..7955fc0d4b 100644 --- a/redfish-core/lib/health.hpp +++ b/redfish-core/lib/health.hpp @@ -67,7 +67,6 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> for (const auto& [path, interfaces] : statuses) { - bool isChild = false; bool isSelf = false; if (selfPath) { @@ -86,6 +85,7 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> // of this association is an inventory item, or one of the // endpoints in this association is a child + bool isChild = false; for (const std::string& child : inventory) { if (path.str.starts_with(child)) diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp index 78bf6269a5..2b27fb4824 100644 --- a/redfish-core/lib/hypervisor_system.hpp +++ b/redfish-core/lib/hypervisor_system.hpp @@ -585,11 +585,10 @@ inline void handleHypervisorIPv4StaticPatch( // address const nlohmann::json& thisJson = input[0]; - // For the error string - std::string pathString = "IPv4StaticAddresses/1"; - if (!thisJson.is_null() && !thisJson.empty()) { + // For the error string + std::string pathString = "IPv4StaticAddresses/1"; std::optional<std::string> address; std::optional<std::string> subnetMask; std::optional<std::string> gateway; diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp index 47f0c5d24f..33aefa3978 100644 --- a/redfish-core/lib/power.hpp +++ b/redfish-core/lib/power.hpp @@ -273,9 +273,6 @@ inline void requestRoutesPower(App& app) } } - nlohmann::json& value = - sensorJson["PowerLimit"]["LimitInWatts"]; - // LimitException is Mandatory attribute as per OCP // Baseline Profile – v1.0.0, so currently making it // "NoAction" as default value to make it OCP Compliant. @@ -285,7 +282,12 @@ inline void requestRoutesPower(App& app) { // Redfish specification indicates PowerLimit should // be null if the limit is not enabled. - value = powerCap * std::pow(10, scale); + sensorJson["PowerLimit"]["LimitInWatts"] = + powerCap * std::pow(10, scale); + } + else + { + sensorJson["PowerLimit"]["LimitInWatts"] = nullptr; } }; diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp index b6c500e814..d9c26f3d86 100644 --- a/redfish-core/lib/processor.hpp +++ b/redfish-core/lib/processor.hpp @@ -1294,9 +1294,9 @@ inline void requestRoutesProcessor(App& app) return; } - std::string appliedConfigUri; if (appliedConfigJson) { + std::string appliedConfigUri; if (!json_util::readJson(*appliedConfigJson, asyncResp->res, "@odata.id", appliedConfigUri)) { diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 3cd437982d..627ba7e50e 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -531,11 +531,10 @@ void getChassis(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, return; } const std::string* chassisPath = nullptr; - std::string chassisName; for (const std::string& chassis : chassisPaths) { sdbusplus::message::object_path path(chassis); - chassisName = path.filename(); + std::string chassisName = path.filename(); if (chassisName.empty()) { BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis; |