summaryrefslogtreecommitdiff
path: root/redfish-core/lib
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2020-09-30 01:15:03 +0300
committerEd Tanous <ed@tanous.net>2020-10-05 20:42:59 +0300
commitd4d25793d79eeee62a5b7f199410c0578070dce1 (patch)
tree0b2a6c8a5fa4c6f97d5b69cbf850dc0daed87234 /redfish-core/lib
parentf2a4a60698a41fbf23e933daaea5df66cde19e53 (diff)
downloadbmcweb-d4d25793d79eeee62a5b7f199410c0578070dce1.tar.xz
Implement bugprone-branch-clone compliance
As part of getting the clang-tidy bugprone tests running, these conditionals were found to have duplicate entries, or be somewhat nonsensical. Tested: clang-tidy now passes with the branch-compliance check set. Change-Id: Ibec106f3bbd866fc471a1fc56bd8cdd5d44024e0
Diffstat (limited to 'redfish-core/lib')
-rw-r--r--redfish-core/lib/account_service.hpp12
-rw-r--r--redfish-core/lib/log_services.hpp29
-rw-r--r--redfish-core/lib/systems.hpp7
3 files changed, 13 insertions, 35 deletions
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index dd63913ef2..897c5c458d 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -143,8 +143,11 @@ inline void userErrorMessageHandler(const sd_bus_error* e,
messages::resourceNotFound(
asyncResp->res, "#ManagerAccount.v1_4_0.ManagerAccount", username);
}
- else if (strcmp(errorMessage,
- "xyz.openbmc_project.Common.Error.InvalidArgument") == 0)
+ else if ((strcmp(errorMessage,
+ "xyz.openbmc_project.Common.Error.InvalidArgument") ==
+ 0) ||
+ (strcmp(errorMessage, "xyz.openbmc_project.User.Common.Error."
+ "UserNameGroupFail") == 0))
{
messages::propertyValueFormatError(asyncResp->res, newUser, "UserName");
}
@@ -153,11 +156,6 @@ inline void userErrorMessageHandler(const sd_bus_error* e,
{
messages::createLimitReachedForResource(asyncResp->res);
}
- else if (strcmp(errorMessage, "xyz.openbmc_project.User.Common.Error."
- "UserNameGroupFail") == 0)
- {
- messages::propertyValueFormatError(asyncResp->res, newUser, "UserName");
- }
else
{
messages::internalError(asyncResp->res);
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 0e93f5ce34..777f37ef1d 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -107,31 +107,16 @@ using GetManagedObjectsType = boost::container::flat_map<
inline std::string translateSeverityDbusToRedfish(const std::string& s)
{
- if (s == "xyz.openbmc_project.Logging.Entry.Level.Alert")
+ if ((s == "xyz.openbmc_project.Logging.Entry.Level.Alert") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Critical") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Emergency") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Error"))
{
return "Critical";
}
- else if (s == "xyz.openbmc_project.Logging.Entry.Level.Critical")
- {
- return "Critical";
- }
- else if (s == "xyz.openbmc_project.Logging.Entry.Level.Debug")
- {
- return "OK";
- }
- else if (s == "xyz.openbmc_project.Logging.Entry.Level.Emergency")
- {
- return "Critical";
- }
- else if (s == "xyz.openbmc_project.Logging.Entry.Level.Error")
- {
- return "Critical";
- }
- else if (s == "xyz.openbmc_project.Logging.Entry.Level.Informational")
- {
- return "OK";
- }
- else if (s == "xyz.openbmc_project.Logging.Entry.Level.Notice")
+ else if ((s == "xyz.openbmc_project.Logging.Entry.Level.Debug") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Informational") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Notice"))
{
return "OK";
}
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index df83f2b92e..34202b11ec 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -1750,7 +1750,7 @@ class SystemActionsReset : public Node
// Get the command and host vs. chassis
std::string command;
bool hostCommand;
- if (resetType == "On")
+ if ((resetType == "On") || (resetType == "ForceOn"))
{
command = "xyz.openbmc_project.State.Host.Transition.On";
hostCommand = true;
@@ -1760,11 +1760,6 @@ class SystemActionsReset : public Node
command = "xyz.openbmc_project.State.Chassis.Transition.Off";
hostCommand = false;
}
- else if (resetType == "ForceOn")
- {
- command = "xyz.openbmc_project.State.Host.Transition.On";
- hostCommand = true;
- }
else if (resetType == "ForceRestart")
{
command =