From 7be48c3cfc65f79f9f9ff257e925466c8ed6666a Mon Sep 17 00:00:00 2001 From: Ivan Chvets Date: Tue, 30 Jul 2024 12:08:37 -0400 Subject: [PATCH] fix: relay errors from ap nos configuration only when strict mode is enabled https://telecominfraproject.atlassian.net/browse/WIFI-14019 Summary of changes: - Modified code to only relay errors from AP NOS configuration update only when strict mode is enabled. NOTE: AP NOS is capable of modifying config thus fixing invalid configs (in some cases) and applying resulting configuration. Warning messages are produced, but error code is being sent back as error/failed. Signed-off-by: Ivan Chvets --- src/RESTAPI/RESTAPI_RPC.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RESTAPI/RESTAPI_RPC.cpp b/src/RESTAPI/RESTAPI_RPC.cpp index 9c9b99b2..c8c7b4ed 100644 --- a/src/RESTAPI/RESTAPI_RPC.cpp +++ b/src/RESTAPI/RESTAPI_RPC.cpp @@ -26,7 +26,7 @@ namespace OpenWifi::RESTAPI_RPC { Poco::JSON::Object RetObj; Cmd.to_json(RetObj); if (Handler != nullptr) - if (Cmd.ErrorCode){ + if (Handler->GetBoolParameter("strict", false) && Cmd.ErrorCode){ return Handler->ReturnObject(RetObj, Poco::Net::HTTPResponse::HTTP_BAD_REQUEST); } return Handler->ReturnObject(RetObj); @@ -171,7 +171,7 @@ namespace OpenWifi::RESTAPI_RPC { } // If the command fails on the device we should show it as failed and not return 200 OK - if (Cmd.ErrorCode) { + if (Handler->GetBoolParameter("strict", false) && Cmd.ErrorCode) { Logger.information(fmt::format( "Command failed with error on device: {} Reason: {}.", Cmd.ErrorCode, Cmd.ErrorText));