diff options
44 files changed, 409 insertions, 388 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 847a43ed65..9d5aa63126 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,7 +205,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") -Wnull-dereference \ -Wdouble-promotion \ -Wformat=2 \ - -Wno-unused-parameter \ + -Wunused-parameter \ " ) endif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0) @@ -228,7 +228,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") -Wno-weak-vtables \ -Wno-documentation \ -Wno-padded \ - -Wno-unused-parameter \ + -Wunused-parameter \ -Wcovered-switch-default \ -Wcomma \ -Wextra-semi \ diff --git a/http/http_client.hpp b/http/http_client.hpp index c455c7bfcf..f4c33467a8 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -257,11 +257,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs << " seconds. RetryCount = " << retryCount; timer.expires_after(std::chrono::seconds(retryIntervalSecs)); - timer.async_wait([self = shared_from_this()]( - const boost::system::error_code& ec) { - self->runningTimer = false; - self->connStateCheck(); - }); + timer.async_wait( + [self = shared_from_this()](const boost::system::error_code&) { + self->runningTimer = false; + self->connStateCheck(); + }); return; } else diff --git a/http/http_connection.h b/http/http_connection.h index 855cc11bcc..da46f77888 100644 --- a/http/http_connection.h +++ b/http/http_connection.h @@ -86,8 +86,7 @@ class Connection : public std::enable_shared_from_this<Connection<Adaptor, Handler>> { public: - Connection(boost::asio::io_context& ioService, Handler* handlerIn, - const std::string& ServerNameIn, + Connection(Handler* handlerIn, const std::string& ServerNameIn, std::function<std::string()>& get_cached_date_str_f, detail::TimerQueue& timerQueueIn, Adaptor adaptorIn) : adaptor(std::move(adaptorIn)), diff --git a/http/http_server.h b/http/http_server.h index 0099274a82..b5fd4da1c8 100644 --- a/http/http_server.h +++ b/http/http_server.h @@ -31,32 +31,32 @@ template <typename Handler, typename Adaptor = boost::asio::ip::tcp::socket> class Server { public: - Server(Handler* handlerIn, std::unique_ptr<tcp::acceptor>&& acceptor, + Server(Handler* handlerIn, std::unique_ptr<tcp::acceptor>&& acceptorIn, std::shared_ptr<boost::asio::ssl::context> adaptor_ctx, std::shared_ptr<boost::asio::io_context> io = std::make_shared<boost::asio::io_context>()) : ioService(std::move(io)), - acceptor(std::move(acceptor)), + acceptor(std::move(acceptorIn)), signals(*ioService, SIGINT, SIGTERM, SIGHUP), tickTimer(*ioService), timer(*ioService), handler(handlerIn), adaptorCtx(adaptor_ctx) {} - Server(Handler* handler, const std::string& bindaddr, uint16_t port, + Server(Handler* handlerIn, const std::string& bindaddr, uint16_t port, std::shared_ptr<boost::asio::ssl::context> adaptor_ctx, std::shared_ptr<boost::asio::io_context> io = std::make_shared<boost::asio::io_context>()) : - Server(handler, + Server(handlerIn, std::make_unique<tcp::acceptor>( *io, tcp::endpoint(boost::asio::ip::make_address(bindaddr), port)), adaptor_ctx, io) {} - Server(Handler* handler, int existing_socket, + Server(Handler* handlerIn, int existing_socket, std::shared_ptr<boost::asio::ssl::context> adaptor_ctx, std::shared_ptr<boost::asio::io_context> io = std::make_shared<boost::asio::io_context>()) : - Server(handler, + Server(handlerIn, std::make_unique<tcp::acceptor>(*io, boost::asio::ip::tcp::v6(), existing_socket), adaptor_ctx, io) @@ -187,13 +187,13 @@ class Server { BMCWEB_LOG_INFO << "Receivied reload signal"; loadCertificate(); - boost::system::error_code ec; - acceptor->cancel(ec); - if (ec) + boost::system::error_code ec2; + acceptor->cancel(ec2); + if (ec2) { BMCWEB_LOG_ERROR << "Error while canceling async operations:" - << ec.message(); + << ec2.message(); } this->startAsyncWaitForSignal(); } @@ -219,7 +219,7 @@ class Server { adaptorTemp = Adaptor(*ioService, *adaptorCtx); auto p = std::make_shared<Connection<Adaptor, Handler>>( - *ioService, handler, serverName, getCachedDateStr, timerQueue, + handler, serverName, getCachedDateStr, timerQueue, std::move(adaptorTemp.value())); acceptor->async_accept(p->socket().next_layer(), @@ -237,7 +237,7 @@ class Server { adaptorTemp = Adaptor(*ioService); auto p = std::make_shared<Connection<Adaptor, Handler>>( - *ioService, handler, serverName, getCachedDateStr, timerQueue, + handler, serverName, getCachedDateStr, timerQueue, std::move(adaptorTemp.value())); acceptor->async_accept( diff --git a/http/logging.h b/http/logging.h index fcac94de18..4498c3de56 100644 --- a/http/logging.h +++ b/http/logging.h @@ -40,8 +40,9 @@ class logger } public: - logger(const std::string& prefix, const std::string& filename, - const size_t line, LogLevel levelIn) : + logger([[maybe_unused]] const std::string& prefix, + [[maybe_unused]] const std::string& filename, + [[maybe_unused]] const size_t line, LogLevel levelIn) : level(levelIn) { #ifdef BMCWEB_ENABLE_LOGGING @@ -63,7 +64,7 @@ class logger // template <typename T> - logger& operator<<(T const& value) + logger& operator<<([[maybe_unused]] T const& value) { if (level >= get_current_log_level()) { diff --git a/http/websocket.h b/http/websocket.h index 5ec6d0ffd5..5e65c993d7 100644 --- a/http/websocket.h +++ b/http/websocket.h @@ -240,26 +240,26 @@ class ConnectionImpl : public Connection return; } doingWrite = true; - ws.async_write( - boost::asio::buffer(outBuffer.front()), - [this, self(shared_from_this())](boost::beast::error_code ec, - std::size_t bytes_written) { - doingWrite = false; - outBuffer.erase(outBuffer.begin()); - if (ec == boost::beast::websocket::error::closed) - { - // Do nothing here. doRead handler will call the - // closeHandler. - close("Write error"); - return; - } - if (ec) - { - BMCWEB_LOG_ERROR << "Error in ws.async_write " << ec; - return; - } - doWrite(); - }); + ws.async_write(boost::asio::buffer(outBuffer.front()), + [this, self(shared_from_this())]( + boost::beast::error_code ec, std::size_t) { + doingWrite = false; + outBuffer.erase(outBuffer.begin()); + if (ec == boost::beast::websocket::error::closed) + { + // Do nothing here. doRead handler will call the + // closeHandler. + close("Write error"); + return; + } + if (ec) + { + BMCWEB_LOG_ERROR << "Error in ws.async_write " + << ec; + return; + } + doWrite(); + }); } private: diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp index 4a5c7c60ea..3f0b826a9e 100644 --- a/include/dbus_monitor.hpp +++ b/include/dbus_monitor.hpp @@ -120,14 +120,15 @@ inline void requestRoutes(App& app) .privileges({"Login"}) .websocket() .onopen([&](crow::websocket::Connection& conn, - std::shared_ptr<bmcweb::AsyncResp> asyncResp) { + std::shared_ptr<bmcweb::AsyncResp>) { BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; sessions[&conn] = DbusWebsocketSession(); }) - .onclose([&](crow::websocket::Connection& conn, - const std::string& reason) { sessions.erase(&conn); }) + .onclose([&](crow::websocket::Connection& conn, const std::string&) { + sessions.erase(&conn); + }) .onmessage([&](crow::websocket::Connection& conn, - const std::string& data, bool is_binary) { + const std::string& data, bool) { DbusWebsocketSession& thisSession = sessions[&conn]; BMCWEB_LOG_DEBUG << "Connection " << &conn << " received " << data; nlohmann::json j = nlohmann::json::parse(data, nullptr, false); diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp index db1e9f32b6..6b77018664 100644 --- a/include/ibm/management_console_rest.hpp +++ b/include/ibm/management_console_rest.hpp @@ -532,7 +532,7 @@ void handleReleaseLockAPI(const crow::Request& req, crow::Response& res, } } -void handleGetLockListAPI(const crow::Request& req, crow::Response& res, +void handleGetLockListAPI(crow::Response& res, const ListOfSessionIds& listSessionIds) { BMCWEB_LOG_DEBUG << listSessionIds.size(); @@ -581,7 +581,7 @@ void requestRoutes(App& app) BMCWEB_ROUTE(app, "/ibm/v1/") .privileges({"ConfigureComponents", "ConfigureManager"}) .methods(boost::beast::http::verb::get)( - [](const crow::Request& req, crow::Response& res) { + [](const crow::Request&, crow::Response& res) { res.jsonValue["@odata.type"] = "#ibmServiceRoot.v1_0_0.ibmServiceRoot"; res.jsonValue["@odata.id"] = "/ibm/v1/"; @@ -599,7 +599,7 @@ void requestRoutes(App& app) BMCWEB_ROUTE(app, "/ibm/v1/Host/ConfigFiles") .privileges({"ConfigureComponents", "ConfigureManager"}) .methods(boost::beast::http::verb::get)( - [](const crow::Request& req, crow::Response& res) { + [](const crow::Request&, crow::Response& res) { handleConfigFileList(res); }); @@ -607,7 +607,7 @@ void requestRoutes(App& app) "/ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll") .privileges({"ConfigureComponents", "ConfigureManager"}) .methods(boost::beast::http::verb::post)( - [](const crow::Request& req, crow::Response& res) { + [](const crow::Request&, crow::Response& res) { deleteConfigFiles(res); }); @@ -621,7 +621,7 @@ void requestRoutes(App& app) BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService") .privileges({"ConfigureComponents", "ConfigureManager"}) .methods(boost::beast::http::verb::get)( - [](const crow::Request& req, crow::Response& res) { + [](const crow::Request&, crow::Response& res) { getLockServiceData(res); }); @@ -682,7 +682,7 @@ void requestRoutes(App& app) res.end(); return; } - handleGetLockListAPI(req, res, listSessionIds); + handleGetLockListAPI(res, listSessionIds); }); BMCWEB_ROUTE(app, "/ibm/v1/HMC/BroadcastService") diff --git a/include/image_upload.hpp b/include/image_upload.hpp index a135af952b..9d0a0ca921 100644 --- a/include/image_upload.hpp +++ b/include/image_upload.hpp @@ -18,8 +18,7 @@ namespace image_upload static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateMatcher; -inline void uploadImageHandler(const crow::Request& req, crow::Response& res, - const std::string& filename) +inline void uploadImageHandler(const crow::Request& req, crow::Response& res) { // Only allow one FW update at a time if (fwUpdateMatcher != nullptr) @@ -115,15 +114,13 @@ inline void requestRoutes(App& app) .privileges({"ConfigureComponents", "ConfigureManager"}) .methods(boost::beast::http::verb::post, boost::beast::http::verb::put)( [](const crow::Request& req, crow::Response& res, - const std::string& filename) { - uploadImageHandler(req, res, filename); - }); + const std::string&) { uploadImageHandler(req, res); }); BMCWEB_ROUTE(app, "/upload/image") .privileges({"ConfigureComponents", "ConfigureManager"}) .methods(boost::beast::http::verb::post, boost::beast::http::verb::put)( [](const crow::Request& req, crow::Response& res) { - uploadImageHandler(req, res, ""); + uploadImageHandler(req, res); }); } } // namespace image_upload diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp index f83c95b525..df50778e43 100644 --- a/include/kvm_websocket.hpp +++ b/include/kvm_websocket.hpp @@ -162,7 +162,7 @@ inline void requestRoutes(App& app) .privileges({"ConfigureComponents", "ConfigureManager"}) .websocket() .onopen([](crow::websocket::Connection& conn, - std::shared_ptr<bmcweb::AsyncResp> asyncResp) { + std::shared_ptr<bmcweb::AsyncResp>) { BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; if (sessions.size() == maxSessions) @@ -173,10 +173,11 @@ inline void requestRoutes(App& app) sessions[&conn] = std::make_unique<KvmSession>(conn); }) - .onclose([](crow::websocket::Connection& conn, - const std::string& reason) { sessions.erase(&conn); }) + .onclose([](crow::websocket::Connection& conn, const std::string&) { + sessions.erase(&conn); + }) .onmessage([](crow::websocket::Connection& conn, - const std::string& data, bool is_binary) { + const std::string& data, bool) { if (sessions[&conn]) { sessions[&conn]->onMessage(data); diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp index 036fe5a0a2..f2de85b7c9 100644 --- a/include/obmc_console.hpp +++ b/include/obmc_console.hpp @@ -107,7 +107,7 @@ inline void requestRoutes(App& app) .privileges({"ConfigureComponents", "ConfigureManager"}) .websocket() .onopen([](crow::websocket::Connection& conn, - std::shared_ptr<bmcweb::AsyncResp> asyncResp) { + std::shared_ptr<bmcweb::AsyncResp>) { BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; sessions.insert(&conn); @@ -122,18 +122,19 @@ inline void requestRoutes(App& app) host_socket->async_connect(ep, connectHandler); } }) - .onclose( - [](crow::websocket::Connection& conn, const std::string& reason) { - sessions.erase(&conn); - if (sessions.empty()) - { - host_socket = nullptr; - inputBuffer.clear(); - inputBuffer.shrink_to_fit(); - } - }) - .onmessage([](crow::websocket::Connection& conn, - const std::string& data, bool is_binary) { + .onclose([](crow::websocket::Connection& conn, + [[maybe_unused]] const std::string& reason) { + sessions.erase(&conn); + if (sessions.empty()) + { + host_socket = nullptr; + inputBuffer.clear(); + inputBuffer.shrink_to_fit(); + } + }) + .onmessage([]([[maybe_unused]] crow::websocket::Connection& conn, + const std::string& data, + [[maybe_unused]] bool is_binary) { inputBuffer += data; doWrite(); }); diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index 57bfc88082..f049c00915 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -791,13 +791,13 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& arg_type, } nlohmann::json::const_iterator it = j->begin(); - for (const std::string& argCode : dbusArgSplit(arg_type)) + for (const std::string& argCode2 : dbusArgSplit(arg_type)) { if (it == j->end()) { return -1; } - r = convertJsonToDbus(m, argCode, *it); + r = convertJsonToDbus(m, argCode2, *it); if (r < 0) { return r; @@ -1556,8 +1556,7 @@ inline void handleAction(const crow::Request& req, crow::Response& res, std::array<std::string, 0>()); } -inline void handleDelete(const crow::Request& req, crow::Response& res, - const std::string& objectPath) +inline void handleDelete(crow::Response& res, const std::string& objectPath) { BMCWEB_LOG_DEBUG << "handleDelete on path: " << objectPath; @@ -2065,7 +2064,7 @@ inline void handleDBusUrl(const crow::Request& req, crow::Response& res, } else if (req.method() == boost::beast::http::verb::delete_) { - handleDelete(req, res, objectPath); + handleDelete(res, objectPath); return; } @@ -2079,7 +2078,7 @@ inline void requestRoutes(App& app) BMCWEB_ROUTE(app, "/bus/") .privileges({"Login"}) .methods(boost::beast::http::verb::get)( - [](const crow::Request& req, crow::Response& res) { + [](const crow::Request&, crow::Response& res) { res.jsonValue = {{"buses", {{{"name", "system"}}}}, {"status", "ok"}}; res.end(); @@ -2088,7 +2087,7 @@ inline void requestRoutes(App& app) BMCWEB_ROUTE(app, "/bus/system/") .privileges({"Login"}) .methods(boost::beast::http::verb::get)( - [](const crow::Request& req, crow::Response& res) { + [](const crow::Request&, crow::Response& res) { auto myCallback = [&res](const boost::system::error_code ec, std::vector<std::string>& names) { if (ec) @@ -2117,7 +2116,7 @@ inline void requestRoutes(App& app) BMCWEB_ROUTE(app, "/list/") .privileges({"Login"}) .methods(boost::beast::http::verb::get)( - [](const crow::Request& req, crow::Response& res) { + [](const crow::Request&, crow::Response& res) { handleList(res, "/"); }); @@ -2161,7 +2160,7 @@ inline void requestRoutes(App& app) BMCWEB_ROUTE(app, "/download/dump/<str>/") .privileges({"ConfigureManager"}) - .methods(boost::beast::http::verb::get)([](const crow::Request& req, + .methods(boost::beast::http::verb::get)([](const crow::Request&, crow::Response& res, const std::string& dumpId) { std::regex validFilename("^[\\w\\- ]+(\\.?[\\w\\- ]*)$"); @@ -2231,7 +2230,7 @@ inline void requestRoutes(App& app) .privileges({"Login"}) .methods(boost::beast::http::verb::get)( - [](const crow::Request& req, crow::Response& res, + [](const crow::Request&, crow::Response& res, const std::string& Connection) { introspectObjects(Connection, "/", std::make_shared<bmcweb::AsyncResp>(res)); diff --git a/include/redfish_v1.hpp b/include/redfish_v1.hpp index cb7af8f1b8..1e4bd658e6 100644 --- a/include/redfish_v1.hpp +++ b/include/redfish_v1.hpp @@ -10,7 +10,7 @@ inline void requestRoutes(App& app) { BMCWEB_ROUTE(app, "/redfish/") .methods(boost::beast::http::verb::get)( - [](const crow::Request& req, crow::Response& res) { + [](const crow::Request&, crow::Response& res) { res.jsonValue = {{"v1", "/redfish/v1/"}}; res.end(); }); diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp index d07469eba2..da9a06f040 100644 --- a/include/vm_websocket.hpp +++ b/include/vm_websocket.hpp @@ -160,7 +160,7 @@ inline void requestRoutes(App& app) .privileges({"ConfigureComponents", "ConfigureManager"}) .websocket() .onopen([](crow::websocket::Connection& conn, - std::shared_ptr<bmcweb::AsyncResp> asyncResp) { + std::shared_ptr<bmcweb::AsyncResp>) { BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; if (session != nullptr) @@ -183,16 +183,21 @@ inline void requestRoutes(App& app) handler = std::make_shared<Handler>(media, conn.get_io_context()); handler->connect(); }) - .onclose( - [](crow::websocket::Connection& conn, const std::string& reason) { - session = nullptr; - handler->doClose(); - handler->inputBuffer->clear(); - handler->outputBuffer->clear(); - handler.reset(); - }) + .onclose([](crow::websocket::Connection& conn, + const std::string& /*reason*/) { + if (&conn != session) + { + return; + } + + session = nullptr; + handler->doClose(); + handler->inputBuffer->clear(); + handler->outputBuffer->clear(); + handler.reset(); + }) .onmessage([](crow::websocket::Connection& conn, - const std::string& data, bool is_binary) { + const std::string& data, bool) { if (data.length() > handler->inputBuffer->capacity()) { BMCWEB_LOG_ERROR << "Buffer overrun when writing " diff --git a/include/webassets.hpp b/include/webassets.hpp index 7e382d886c..7cf6c93e3a 100644 --- a/include/webassets.hpp +++ b/include/webassets.hpp @@ -128,8 +128,8 @@ inline void requestRoutes(App& app) } app.routeDynamic(webpath)( - [absolutePath, contentType, contentEncoding]( - const crow::Request& req, crow::Response& res) { + [absolutePath, contentType, + contentEncoding](const crow::Request&, crow::Response& res) { if (contentType != nullptr) { res.addHeader("Content-Type", contentType); diff --git a/redfish-core/include/node.hpp b/redfish-core/include/node.hpp index b21fba542b..797160db7f 100644 --- a/redfish-core/include/node.hpp +++ b/redfish-core/include/node.hpp @@ -53,7 +53,7 @@ class Node { public: template <typename... Params> - Node(App& app, std::string&& entityUrl, Params... paramsIn) + Node(App& app, std::string&& entityUrl, [[maybe_unused]] Params... paramsIn) { crow::DynamicRule& get = app.routeDynamic(entityUrl.c_str()); getRule = &get; @@ -157,36 +157,36 @@ class Node protected: // Node is designed to be an abstract class, so doGet is pure virtual - virtual void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) + virtual void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) { res.result(boost::beast::http::status::method_not_allowed); res.end(); } - virtual void doPatch(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) + virtual void doPatch(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) { res.result(boost::beast::http::status::method_not_allowed); res.end(); } - virtual void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) + virtual void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) { res.result(boost::beast::http::status::method_not_allowed); res.end(); } - virtual void doPut(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) + virtual void doPut(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) { res.result(boost::beast::http::status::method_not_allowed); res.end(); } - virtual void doDelete(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) + virtual void doDelete(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) { res.result(boost::beast::http::status::method_not_allowed); res.end(); diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp index d9bf1fc458..2d44545462 100644 --- a/redfish-core/include/privileges.hpp +++ b/redfish-core/include/privileges.hpp @@ -309,7 +309,7 @@ inline bool isMethodAllowedWithPrivileges(const boost::beast::http::verb method, */ inline bool isMethodAllowedForUser(const boost::beast::http::verb method, const OperationMap& operationMap, - const std::string& user) + const std::string&) { // TODO: load user privileges from configuration as soon as its available // now we are granting all privileges to everyone. diff --git a/redfish-core/include/server_sent_events.hpp b/redfish-core/include/server_sent_events.hpp index 9f0da8ff02..ada5da7b22 100644 --- a/redfish-core/include/server_sent_events.hpp +++ b/redfish-core/include/server_sent_events.hpp @@ -107,8 +107,9 @@ class ServerSentEvents : public std::enable_shared_from_this<ServerSentEvents> sseConn->async_write_some( boost::asio::buffer(outBuffer.data(), outBuffer.size()), - [self(shared_from_this())](boost::beast::error_code ec, - const std::size_t& bytesTransferred) { + [self(shared_from_this())]( + boost::beast::error_code ec, + [[maybe_unused]] const std::size_t& bytesTransferred) { self->outBuffer.erase(0, bytesTransferred); if (ec == boost::asio::error::eof) @@ -131,7 +132,6 @@ class ServerSentEvents : public std::enable_shared_from_this<ServerSentEvents> } BMCWEB_LOG_DEBUG << "async_write_some() bytes transferred: " << bytesTransferred; - boost::ignore_unused(bytesTransferred); self->doWrite(); }); @@ -164,8 +164,9 @@ class ServerSentEvents : public std::enable_shared_from_this<ServerSentEvents> boost::beast::http::async_write_header( *sseConn, *serializer, - [this, response, serializer](const boost::beast::error_code& ec, - const std::size_t& bytesTransferred) { + [this, response, + serializer](const boost::beast::error_code& ec, + [[maybe_unused]] const std::size_t& bytesTransferred) { if (ec) { BMCWEB_LOG_ERROR << "Error sending header" << ec; diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp index d578de4c46..c4f54d719c 100644 --- a/redfish-core/include/utils/json_utils.hpp +++ b/redfish-core/include/utils/json_utils.hpp @@ -86,8 +86,7 @@ enum class UnpackErrorCode }; template <typename ToType, typename FromType> -bool checkRange(const FromType& from, nlohmann::json& jsonValue, - const std::string& key) +bool checkRange(const FromType& from, const std::string& key) { if (from > std::numeric_limits<ToType>::max()) { @@ -137,7 +136,7 @@ UnpackErrorCode unpackValueWithErrorCode(nlohmann::json& jsonValue, { return UnpackErrorCode::invalidType; } - if (!checkRange<Type>(*jsonPtr, jsonValue, key)) + if (!checkRange<Type>(*jsonPtr, key)) { return UnpackErrorCode::outOfRange; } @@ -151,7 +150,7 @@ UnpackErrorCode unpackValueWithErrorCode(nlohmann::json& jsonValue, { return UnpackErrorCode::invalidType; } - if (!checkRange<Type>(*jsonPtr, jsonValue, key)) + if (!checkRange<Type>(*jsonPtr, key)) { return UnpackErrorCode::outOfRange; } @@ -166,7 +165,7 @@ UnpackErrorCode unpackValueWithErrorCode(nlohmann::json& jsonValue, { return UnpackErrorCode::invalidType; } - if (!checkRange<Type>(*jsonPtr, jsonValue, key)) + if (!checkRange<Type>(*jsonPtr, key)) { return UnpackErrorCode::outOfRange; } @@ -326,8 +325,8 @@ bool unpackValue(nlohmann::json& jsonValue, const std::string& key, Type& value) } template <size_t Count, size_t Index> -bool readJsonValues(const std::string& key, nlohmann::json& jsonValue, - crow::Response& res, std::bitset<Count>& handled) +bool readJsonValues(const std::string& key, nlohmann::json&, + crow::Response& res, std::bitset<Count>&) { BMCWEB_LOG_DEBUG << "Unable to find variable for key" << key; messages::propertyUnknown(res, key); @@ -356,7 +355,7 @@ bool readJsonValues(const std::string& key, nlohmann::json& jsonValue, } template <size_t Index = 0, size_t Count> -bool handleMissing(std::bitset<Count>& handled, crow::Response& res) +bool handleMissing(std::bitset<Count>&, crow::Response&) { return true; } @@ -364,7 +363,7 @@ bool handleMissing(std::bitset<Count>& handled, crow::Response& res) template <size_t Index = 0, size_t Count, typename ValueType, typename... UnpackTypes> bool handleMissing(std::bitset<Count>& handled, crow::Response& res, - const char* key, ValueType& unused, UnpackTypes&... in) + const char* key, ValueType&, UnpackTypes&... in) { bool ret = true; if (!handled.test(Index) && !is_optional_v<ValueType>) diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp index b8517b4a35..fae181ce89 100644 --- a/redfish-core/lib/account_service.hpp +++ b/redfish-core/lib/account_service.hpp @@ -965,8 +965,6 @@ class AccountService : public Node void handleLDAPPatch(nlohmann::json& input, const std::shared_ptr<AsyncResp>& asyncResp, - const crow::Request& req, - const std::vector<std::string>& params, const std::string& serverType) { std::string dbusObjectPath; @@ -978,6 +976,10 @@ class AccountService : public Node { dbusObjectPath = ldapConfigObjectName; } + else + { + return; + } std::optional<nlohmann::json> authentication; std::optional<nlohmann::json> ldapService; @@ -1121,8 +1123,8 @@ class AccountService : public Node }); } - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { const persistent_data::AuthConfigMethods& authMethodsConfig = persistent_data::SessionStore::getInstance().getAuthMethodsConfig(); @@ -1210,6 +1212,10 @@ class AccountService : public Node auto callback = [asyncResp](bool success, LDAPConfigData& confData, const std::string& ldapType) { + if (!success) + { + return; + } parseLDAPConfigData(asyncResp->res.jsonValue, confData, ldapType); }; @@ -1218,7 +1224,7 @@ class AccountService : public Node } void doPatch(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -1252,7 +1258,7 @@ class AccountService : public Node if (ldapObject) { - handleLDAPPatch(*ldapObject, asyncResp, req, params, "LDAP"); + handleLDAPPatch(*ldapObject, asyncResp, "LDAP"); } if (std::optional<nlohmann::json> oemOpenBMCObject; @@ -1273,7 +1279,7 @@ class AccountService : public Node if (activeDirectoryObject) { - handleLDAPPatch(*activeDirectoryObject, asyncResp, req, params, + handleLDAPPatch(*activeDirectoryObject, asyncResp, "ActiveDirectory"); } @@ -1337,7 +1343,7 @@ class AccountsCollection : public Node private: void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); res.jsonValue = {{"@odata.id", "/redfish/v1/AccountService/Accounts"}, @@ -1393,7 +1399,7 @@ class AccountsCollection : public Node "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); } void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -1886,7 +1892,7 @@ class ManagerAccount : public Node }); } - void doDelete(crow::Response& res, const crow::Request& req, + void doDelete(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { auto asyncResp = std::make_shared<AsyncResp>(res); diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp index b997ad484b..8acf29be3d 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -17,8 +17,8 @@ class BiosService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -55,8 +55,8 @@ class BiosReset : public Node * Function handles POST method request. * Analyzes POST body message before sends Reset request data to D-Bus. */ - void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp index e237fd35f2..35c60b17fd 100644 --- a/redfish-core/lib/certificate_service.hpp +++ b/redfish-core/lib/certificate_service.hpp @@ -68,8 +68,8 @@ class CertificateService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue = { {"@odata.type", "#CertificateService.v1_0_0.CertificateService"}, @@ -261,7 +261,7 @@ class CertificateActionGenerateCSR : public Node private: void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { static const int RSA_KEY_BIT_LENGTH = 2048; auto asyncResp = std::make_shared<AsyncResp>(res); @@ -479,7 +479,7 @@ class CertificateActionGenerateCSR : public Node }); crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code& ec, - const std::string& path) { + const std::string&) { if (ec) { BMCWEB_LOG_ERROR << "DBUS response error: " << ec.message(); @@ -699,7 +699,7 @@ class CertificateActionsReplaceCertificate : public Node private: void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::string certificate; nlohmann::json certificateUri; @@ -866,8 +866,8 @@ class HTTPSCertificateCollection : public Node {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}}, {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; } - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue = { {"@odata.id", @@ -907,7 +907,7 @@ class HTTPSCertificateCollection : public Node } void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { BMCWEB_LOG_DEBUG << "HTTPSCertificateCollection::doPost"; auto asyncResp = std::make_shared<AsyncResp>(res); @@ -978,8 +978,8 @@ class CertificateLocations : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue = { {"@odata.id", @@ -1066,8 +1066,8 @@ class LDAPCertificateCollection : public Node {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}}, {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; } - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue = { {"@odata.id", "/redfish/v1/AccountService/LDAP/Certificates"}, @@ -1105,7 +1105,7 @@ class LDAPCertificateCollection : public Node } void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); std::string certFileBody = getCertificateFromReqBody(asyncResp, req); @@ -1172,7 +1172,7 @@ class LDAPCertificate : public Node } void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); long id = getIDFromURL(req.url); @@ -1209,8 +1209,8 @@ class TrustStoreCertificateCollection : public Node {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}}, {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; } - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue = { {"@odata.id", "/redfish/v1/Managers/bmc/Truststore/Certificates/"}, @@ -1249,7 +1249,7 @@ class TrustStoreCertificateCollection : public Node } void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); std::string certFileBody = getCertificateFromReqBody(asyncResp, req); @@ -1316,7 +1316,7 @@ class TrustStoreCertificate : public Node } void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); long id = getIDFromURL(req.url); diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp index 10b07980e0..c7db370830 100644 --- a/redfish-core/lib/chassis.hpp +++ b/redfish-core/lib/chassis.hpp @@ -175,8 +175,8 @@ class ChassisCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#ChassisCollection.ChassisCollection"; res.jsonValue["@odata.id"] = "/redfish/v1/Chassis"; @@ -242,7 +242,7 @@ class Chassis : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { const std::array<const char*, 2> interfaces = { @@ -356,6 +356,11 @@ class Chassis : public Node const boost::system::error_code ec2, const std::vector<std::pair< std::string, VariantType>>& propertiesList) { + if (ec2) + { + return; + } + for (const std::pair<std::string, VariantType>& property : propertiesList) { @@ -570,7 +575,7 @@ class ChassisResetAction : public Node * Analyzes POST body before sending Reset request data to D-Bus. */ void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { BMCWEB_LOG_DEBUG << "Post Chassis Reset."; @@ -621,7 +626,7 @@ class ChassisResetActionInfo : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { if (params.size() != 1) diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp index b4178b41bc..7b5ca4359c 100644 --- a/redfish-core/lib/cpudimm.hpp +++ b/redfish-core/lib/cpudimm.hpp @@ -1050,8 +1050,8 @@ class ProcessorCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#ProcessorCollection.ProcessorCollection"; @@ -1088,7 +1088,7 @@ class Processor : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { // Check if there is required param, truly entering this shall be @@ -1135,8 +1135,8 @@ class MemoryCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#MemoryCollection.MemoryCollection"; res.jsonValue["Name"] = "Memory Module Collection"; @@ -1170,7 +1170,7 @@ class Memory : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { // Check if there is required param, truly entering this shall be diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 852b3b72c4..babfd4a412 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -731,9 +731,8 @@ inline void deleteIPv4(const std::string& ifaceId, const std::string& ipHash, * * @return None */ -inline void createIPv4(const std::string& ifaceId, unsigned int ipIdx, - uint8_t prefixLength, const std::string& gateway, - const std::string& address, +inline void createIPv4(const std::string& ifaceId, uint8_t prefixLength, + const std::string& gateway, const std::string& address, std::shared_ptr<AsyncResp> asyncResp) { crow::connections::systemBus->async_method_call( @@ -1019,8 +1018,8 @@ class EthernetCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#EthernetInterfaceCollection.EthernetInterfaceCollection"; @@ -1551,8 +1550,8 @@ class EthernetInterface : public Node } else { - createIPv4(ifaceId, entryIdx, prefixLength, *gateway, - *address, asyncResp); + createIPv4(ifaceId, prefixLength, *gateway, *address, + asyncResp); } entryIdx++; } @@ -1868,7 +1867,7 @@ class EthernetInterface : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2079,11 +2078,10 @@ class VlanNetworkInterface : public Node } private: - void parseInterfaceData( - nlohmann::json& json_response, const std::string& parent_iface_id, - const std::string& iface_id, const EthernetInterfaceData& ethData, - const boost::container::flat_set<IPv4AddressData>& ipv4Data, - const boost::container::flat_set<IPv6AddressData>& ipv6Data) + void parseInterfaceData(nlohmann::json& json_response, + const std::string& parent_iface_id, + const std::string& iface_id, + const EthernetInterfaceData& ethData) { // Fill out obvious data... json_response["Id"] = iface_id; @@ -2113,7 +2111,7 @@ class VlanNetworkInterface : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2146,13 +2144,12 @@ class VlanNetworkInterface : public Node [this, asyncResp, parent_iface_id{std::string(params[0])}, iface_id{std::string(params[1])}]( const bool& success, const EthernetInterfaceData& ethData, - const boost::container::flat_set<IPv4AddressData>& ipv4Data, - const boost::container::flat_set<IPv6AddressData>& ipv6Data) { + const boost::container::flat_set<IPv4AddressData>&, + const boost::container::flat_set<IPv6AddressData>&) { if (success && ethData.vlan_id.size() != 0) { parseInterfaceData(asyncResp->res.jsonValue, - parent_iface_id, iface_id, ethData, - ipv4Data, ipv6Data); + parent_iface_id, iface_id, ethData); } else { @@ -2199,10 +2196,10 @@ class VlanNetworkInterface : public Node getEthernetIfaceData( params[1], [asyncResp, parentIfaceId{std::string(params[0])}, - ifaceId{std::string(params[1])}, &vlanEnable, &vlanId]( - const bool& success, const EthernetInterfaceData& ethData, - const boost::container::flat_set<IPv4AddressData>& ipv4Data, - const boost::container::flat_set<IPv6AddressData>& ipv6Data) { + ifaceId{std::string(params[1])}, &vlanEnable, + &vlanId](const bool& success, const EthernetInterfaceData& ethData, + const boost::container::flat_set<IPv4AddressData>&, + const boost::container::flat_set<IPv6AddressData>&) { if (success && !ethData.vlan_id.empty()) { auto callback = @@ -2244,7 +2241,7 @@ class VlanNetworkInterface : public Node }); } - void doDelete(crow::Response& res, const crow::Request& req, + void doDelete(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2271,8 +2268,8 @@ class VlanNetworkInterface : public Node [asyncResp, parentIfaceId{std::string(params[0])}, ifaceId{std::string(params[1])}]( const bool& success, const EthernetInterfaceData& ethData, - const boost::container::flat_set<IPv4AddressData>& ipv4Data, - const boost::container::flat_set<IPv6AddressData>& ipv6Data) { + const boost::container::flat_set<IPv4AddressData>&, + const boost::container::flat_set<IPv6AddressData>&) { if (success && !ethData.vlan_id.empty()) { auto callback = @@ -2323,7 +2320,7 @@ class VlanNetworkInterfaceCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp index fa06fcf0b8..7d17ceacb2 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -51,8 +51,8 @@ class EventService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); res.jsonValue = { @@ -92,7 +92,7 @@ class EventService : public Node } void doPatch(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -167,8 +167,8 @@ class SubmitTestEvent : public Node } private: - void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { EventServiceManager::getInstance().sendTestEventLog(); res.result(boost::beast::http::status::no_content); @@ -192,8 +192,8 @@ class EventDestinationCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -219,7 +219,7 @@ class EventDestinationCollection : public Node } void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -464,7 +464,7 @@ class EventServiceSSE : public Node private: void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { if (EventServiceManager::getInstance().getNumberOfSubscriptions() >= maxNoOfSubscriptions) @@ -569,7 +569,7 @@ class EventDestination : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -674,7 +674,7 @@ class EventDestination : public Node EventServiceManager::getInstance().updateSubscriptionData(); } - void doDelete(crow::Response& res, const crow::Request& req, + void doDelete(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { auto asyncResp = std::make_shared<AsyncResp>(res); diff --git a/redfish-core/lib/hypervisor_ethernet.hpp b/redfish-core/lib/hypervisor_ethernet.hpp index f0955b21c0..3266069055 100644 --- a/redfish-core/lib/hypervisor_ethernet.hpp +++ b/redfish-core/lib/hypervisor_ethernet.hpp @@ -34,13 +34,13 @@ class HypervisorSystem : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec, - const std::variant<std::string>& hostName) { + const std::variant<std::string>& /*hostName*/) { if (ec) { messages::resourceNotFound(asyncResp->res, "System", @@ -90,8 +90,8 @@ class HypervisorInterfaceCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); const std::array<const char*, 1> interfaces = { @@ -399,7 +399,6 @@ inline void setHypervisorIPv4Subnet(std::shared_ptr<AsyncResp> aResp, * @return None. */ inline void setHypervisorIPv4Gateway(std::shared_ptr<AsyncResp> aResp, - const std::string& ethIfaceId, const std::string& gateway) { BMCWEB_LOG_DEBUG @@ -439,7 +438,7 @@ inline void createHypervisorIPv4(const std::string& ifaceId, std::shared_ptr<AsyncResp> asyncResp) { setHypervisorIPv4Address(asyncResp, ifaceId, address); - setHypervisorIPv4Gateway(asyncResp, ifaceId, gateway); + setHypervisorIPv4Gateway(asyncResp, gateway); setHypervisorIPv4Subnet(asyncResp, ifaceId, prefixLength); } @@ -458,7 +457,7 @@ inline void deleteHypervisorIPv4(const std::string& ifaceId, std::string gateway = "0.0.0.0"; const uint8_t prefixLength = 0; setHypervisorIPv4Address(asyncResp, ifaceId, address); - setHypervisorIPv4Gateway(asyncResp, ifaceId, gateway); + setHypervisorIPv4Gateway(asyncResp, gateway); setHypervisorIPv4Subnet(asyncResp, ifaceId, prefixLength); } @@ -744,7 +743,7 @@ class HypervisorInterface : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -822,7 +821,7 @@ class HypervisorInterface : public Node ipv4DHCPEnabled = std::move(ipv4DHCPEnabled), dhcpv4 = std::move(dhcpv4)]( const bool& success, const EthernetInterfaceData& ethData, - const boost::container::flat_set<IPv4AddressData>& ipv4Data) { + const boost::container::flat_set<IPv4AddressData>&) { if (!success) { messages::resourceNotFound(asyncResp->res, diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp index a2a5bc9bc7..f9e0c474f3 100644 --- a/redfish-core/lib/led.hpp +++ b/redfish-core/lib/led.hpp @@ -120,8 +120,7 @@ inline void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp, } crow::connections::systemBus->async_method_call( - [aResp, ledOn, ledBlinkng](const boost::system::error_code ec, - const std::variant<bool> asserted) mutable { + [aResp, ledOn, ledBlinkng](const boost::system::error_code ec) mutable { if (ec) { // Some systems may not have enclosure_identify_blink object so @@ -133,8 +132,7 @@ inline void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp, } } crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec2, - const std::variant<bool> asserted2) { + [aResp](const boost::system::error_code ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index a4a873a28e..c4106b09a3 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -730,9 +730,14 @@ inline void createDumpTaskCallback(const crow::Request& req, const std::string& dumpType) { std::shared_ptr<task::TaskData> task = task::TaskData::createTask( - [dumpId, dumpPath, dumpType]( + [dumpId, dumpPath, dumpType, asyncResp]( boost::system::error_code err, sdbusplus::message::message& m, const std::shared_ptr<task::TaskData>& taskData) { + if (err) + { + messages::internalError(asyncResp->res); + return false; + } std::vector<std::pair< std::string, std::vector<std::pair<std::string, std::variant<std::string>>>>> @@ -946,8 +951,8 @@ class SystemLogServiceCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); // Collections don't include the static data added by SubRoute because @@ -1023,8 +1028,8 @@ class EventLogService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -1063,8 +1068,8 @@ class JournalEventLogClear : public Node } private: - void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -1211,7 +1216,7 @@ class JournalEventLogEntryCollection : public Node private: void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); uint64_t skip = 0; @@ -1313,7 +1318,7 @@ class JournalEventLogEntry : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -1388,8 +1393,8 @@ class DBusEventLogEntryCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -1530,7 +1535,7 @@ class DBusEventLogEntry : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -1626,7 +1631,7 @@ class DBusEventLogEntry : public Node "xyz.openbmc_project.Logging.Entry"); } - void doDelete(crow::Response& res, const crow::Request& req, + void doDelete(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { @@ -1687,8 +1692,8 @@ class BMCLogServiceCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); // Collections don't include the static data added by SubRoute because @@ -1731,8 +1736,8 @@ class BMCJournalLogService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); asyncResp->res.jsonValue["@odata.type"] = @@ -1812,7 +1817,7 @@ class BMCJournalLogEntryCollection : public Node private: void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); static constexpr const long maxEntriesPerPage = 1000; @@ -1915,7 +1920,7 @@ class BMCJournalLogEntry : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2001,8 +2006,8 @@ class BMCDumpService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2047,8 +2052,8 @@ class BMCDumpEntryCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2081,7 +2086,7 @@ class BMCDumpEntry : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2093,7 +2098,7 @@ class BMCDumpEntry : public Node getDumpEntryById(asyncResp, params[0], "BMC"); } - void doDelete(crow::Response& res, const crow::Request& req, + void doDelete(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2125,7 +2130,7 @@ class BMCDumpCreate : public Node private: void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { createDump(res, req, "BMC"); } @@ -2179,8 +2184,8 @@ class BMCDumpClear : public Node } private: - void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { clearDump(res, "xyz.openbmc_project.Dump.Entry.BMC"); } @@ -2202,8 +2207,8 @@ class SystemDumpService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2249,8 +2254,8 @@ class SystemDumpEntryCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2283,7 +2288,7 @@ class SystemDumpEntry : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2295,7 +2300,7 @@ class SystemDumpEntry : public Node getDumpEntryById(asyncResp, params[0], "System"); } - void doDelete(crow::Response& res, const crow::Request& req, + void doDelete(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2327,7 +2332,7 @@ class SystemDumpCreate : public Node private: void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { createDump(res, req, "System"); } @@ -2382,8 +2387,8 @@ class SystemDumpClear : public Node } private: - void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { clearDump(res, "xyz.openbmc_project.Dump.Entry.System"); } @@ -2410,8 +2415,8 @@ class CrashdumpService : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); // Copy over the static data to include the entries added by SubRoute @@ -2467,14 +2472,14 @@ class CrashdumpClear : public Node } private: - void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec, - const std::string& resp) { + const std::string&) { if (ec) { messages::internalError(asyncResp->res); @@ -2562,8 +2567,8 @@ class CrashdumpEntryCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); // Collections don't include the static data added by SubRoute because @@ -2646,7 +2651,7 @@ class CrashdumpEntry : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2681,7 +2686,7 @@ class CrashdumpFile : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -2784,14 +2789,14 @@ class OnDemandCrashdump : public Node private: void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); auto generateonDemandLogCallback = [asyncResp, req](const boost::system::error_code ec, - const std::string& resp) { + const std::string&) { if (ec) { if (ec.value() == boost::system::errc::operation_not_supported) @@ -2856,14 +2861,14 @@ class TelemetryCrashdump : public Node private: void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); auto generateTelemetryLogCallback = [asyncResp, req]( const boost::system::error_code ec, - const std::string& resp) { + const std::string&) { if (ec) { if (ec.value() == boost::system::errc::operation_not_supported) @@ -2928,7 +2933,7 @@ class SendRawPECI : public Node private: void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); std::vector<std::vector<uint8_t>> peciCommands; @@ -3026,8 +3031,8 @@ class DBusLogServiceActionsClear : public Node * The Clear Log actions does not require any parameter.The action deletes * all entries found in the Entries collection for this Log Service. */ - void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { BMCWEB_LOG_DEBUG << "Do delete all entries."; @@ -3075,8 +3080,8 @@ class PostCodesLogService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -3114,8 +3119,8 @@ class PostCodesClear : public Node } private: - void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doPost(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { BMCWEB_LOG_DEBUG << "Do delete all postcodes entries."; @@ -3393,7 +3398,7 @@ class PostCodesEntryCollection : public Node private: void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -3442,7 +3447,7 @@ class PostCodesEntry : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index a113ba169f..56abdcffa5 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -87,7 +87,7 @@ class ManagerResetAction : public Node * OpenBMC only supports ResetType "GracefulRestart". */ void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { BMCWEB_LOG_DEBUG << "Post Manager Reset."; @@ -139,7 +139,7 @@ class ManagerResetToDefaultsAction : public Node * OpenBMC only supports ResetToDefaultsType "ResetAll". */ void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { BMCWEB_LOG_DEBUG << "Post ResetToDefaults."; @@ -210,8 +210,8 @@ class ManagerResetActionInfo : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue = { {"@odata.type", "#ActionInfo.v1_1_2.ActionInfo"}, @@ -1372,11 +1372,11 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues> const std::string& owner = subtree[0].second[0].first; crow::connections::systemBus->async_method_call( [self, path, owner]( - const boost::system::error_code ec, + const boost::system::error_code ec2, const boost::container::flat_map< std::string, std::variant<std::vector<std::string>, std::string>>& r) { - if (ec) + if (ec2) { BMCWEB_LOG_ERROR << "SetPIDValues: Can't get " "thermalModeIface " @@ -1673,8 +1673,8 @@ class Manager : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.id"] = "/redfish/v1/Managers/bmc"; res.jsonValue["@odata.type"] = "#Manager.v1_9_0.Manager"; @@ -1806,7 +1806,7 @@ class Manager : public Node } void doPatch(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::optional<nlohmann::json> oem; std::optional<nlohmann::json> links; @@ -2088,8 +2088,8 @@ class ManagerCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { // Collections don't include the static data added by SubRoute // because it has a duplicate entry for members diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp index 63aa5f3cf7..77fc10eba9 100644 --- a/redfish-core/lib/message_registries.hpp +++ b/redfish-core/lib/message_registries.hpp @@ -44,8 +44,8 @@ class MessageRegistryFileCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { // Collections don't include the static data added by SubRoute because // it has a duplicate entry for members @@ -83,7 +83,7 @@ class MessageRegistryFile : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { if (params.size() != 1) @@ -169,7 +169,7 @@ class MessageRegistry : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { if (params.size() != 2) diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index 4d612fc037..75e3aa8a2a 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -143,8 +143,8 @@ class NetworkProtocol : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -168,6 +168,11 @@ class NetworkProtocol : public Node crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code error_code, const std::variant<std::string>& timeSyncMethod) { + if (error_code) + { + return; + } + const std::string* s = std::get_if<std::string>(&timeSyncMethod); @@ -404,7 +409,12 @@ class NetworkProtocol : public Node } crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code error_code) {}, + [asyncResp](const boost::system::error_code error_code) { + if (error_code) + { + messages::internalError(asyncResp->res); + } + }, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/time/sync_method", "org.freedesktop.DBus.Properties", "Set", @@ -488,7 +498,7 @@ class NetworkProtocol : public Node } void doPatch(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); std::optional<std::string> newHostName; diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp index e2f35917b6..21ec6dc390 100644 --- a/redfish-core/lib/pcie.hpp +++ b/redfish-core/lib/pcie.hpp @@ -88,8 +88,8 @@ class SystemPCIeDeviceCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); asyncResp->res.jsonValue = { @@ -120,7 +120,7 @@ class SystemPCIeDevice : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -208,7 +208,7 @@ class SystemPCIeFunctionCollection : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); @@ -301,7 +301,7 @@ class SystemPCIeFunction : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp index 031657ae59..ffe0ed5480 100644 --- a/redfish-core/lib/power.hpp +++ b/redfish-core/lib/power.hpp @@ -139,7 +139,7 @@ class Power : public Node }; getValidChassisPath(asyncResp, std::move(getChassisPath)); } - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { if (params.size() != 1) diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp index e54492d908..1d8e3c4fcc 100644 --- a/redfish-core/lib/redfish_sessions.hpp +++ b/redfish-core/lib/redfish_sessions.hpp @@ -41,7 +41,7 @@ class Sessions : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { // Note that control also reaches here via doPost and doDelete. @@ -145,8 +145,8 @@ class SessionCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::vector<const std::string*> sessionIds = persistent_data::SessionStore::getInstance().getUniqueIds( @@ -168,7 +168,7 @@ class SessionCollection : public Node } void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::string username; std::string password; @@ -275,8 +275,8 @@ class SessionService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#SessionService.v1_0_2.SessionService"; res.jsonValue["@odata.id"] = "/redfish/v1/SessionService/"; diff --git a/redfish-core/lib/roles.hpp b/redfish-core/lib/roles.hpp index 9c86d4bb28..610c08663b 100644 --- a/redfish-core/lib/roles.hpp +++ b/redfish-core/lib/roles.hpp @@ -86,7 +86,7 @@ class Roles : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { if (params.size() != 1) @@ -133,8 +133,8 @@ class RoleCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); res.jsonValue = {{"@odata.id", "/redfish/v1/AccountService/Roles"}, diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index d1895c45fb..ac987359ce 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -304,7 +304,7 @@ void getConnections( auto objectsWithConnectionCb = [callback](const boost::container::flat_set<std::string>& connections, const std::set<std::pair<std::string, std::string>>& - objectsWithConnection) { + /*objectsWithConnection*/) { callback(std::move(connections)); }; getObjectsWithConnection(SensorsAsyncResp, sensorNames, @@ -2770,7 +2770,7 @@ inline void setSensorsOverride( // Get the connection to which the memberId belongs auto getObjectsWithConnectionCb = [sensorAsyncResp, overrideMap]( - const boost::container::flat_set<std::string>& connections, + const boost::container::flat_set<std::string>& /*connections*/, const std::set<std::pair<std::string, std::string>>& objectsWithConnection) { if (objectsWithConnection.size() != overrideMap.size()) @@ -3012,7 +3012,7 @@ class SensorCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { BMCWEB_LOG_DEBUG << "SensorCollection doGet enter"; @@ -3084,7 +3084,7 @@ class Sensor : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { BMCWEB_LOG_DEBUG << "Sensor doGet enter"; diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp index 52e899ea15..629280c5ec 100644 --- a/redfish-core/lib/service_root.hpp +++ b/redfish-core/lib/service_root.hpp @@ -38,8 +38,8 @@ class ServiceRoot : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#ServiceRoot.v1_5_0.ServiceRoot"; res.jsonValue["@odata.id"] = "/redfish/v1"; diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp index 9b1e2d7e33..ccd8ab8eda 100644 --- a/redfish-core/lib/storage.hpp +++ b/redfish-core/lib/storage.hpp @@ -38,8 +38,8 @@ class StorageCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#StorageCollection.StorageCollection"; res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Storage"; @@ -66,8 +66,8 @@ class Storage : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#Storage.v1_7_1.Storage"; res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Storage/1"; @@ -289,7 +289,7 @@ class Drive : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -353,12 +353,12 @@ class Drive : public Node const std::string& connectionName = connectionNames[0].first; crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code ec, + [asyncResp](const boost::system::error_code ec2, const std::vector<std::pair< std::string, std::variant<bool, std::string, uint64_t>>>& propertiesList) { - if (ec) + if (ec2) { // this interface isn't necessary return; @@ -400,11 +400,11 @@ class Drive : public Node health->populate(); crow::connections::systemBus->async_method_call( - [asyncResp, path](const boost::system::error_code ec, + [asyncResp, path](const boost::system::error_code ec2, const std::variant<bool> present) { // this interface isn't necessary, only check it if we // get a good return - if (ec) + if (ec2) { return; } @@ -425,11 +425,11 @@ class Drive : public Node "Get", "xyz.openbmc_project.Inventory.Item", "Present"); crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code ec, + [asyncResp](const boost::system::error_code ec2, const std::variant<bool> rebuilding) { // this interface isn't necessary, only check it if we // get a good return - if (ec) + if (ec2) { return; } diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index c4bc3d4863..fb1288e6b9 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -202,14 +202,14 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp, crow::connections::systemBus->async_method_call( [aResp, service{connection.first}, path(std::move(path))]( - const boost::system::error_code ec, + const boost::system::error_code ec2, const std::vector< std::pair<std::string, VariantType>>& properties) { - if (ec) + if (ec2) { BMCWEB_LOG_ERROR - << "DBUS response error " << ec; + << "DBUS response error " << ec2; messages::internalError(aResp->res); return; } @@ -268,15 +268,15 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp, auto getDimmProperties = [aResp]( const boost::system::error_code - ec, + ec3, const std::variant<bool>& dimmState) { - if (ec) + if (ec3) { BMCWEB_LOG_ERROR << "DBUS response " "error " - << ec; + << ec3; return; } updateDimmProperties(aResp, @@ -309,14 +309,14 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp, crow::connections::systemBus->async_method_call( [aResp, service{connection.first}, path(std::move(path))]( - const boost::system::error_code ec, + const boost::system::error_code ec2, const std::vector< std::pair<std::string, VariantType>>& properties) { - if (ec) + if (ec2) { BMCWEB_LOG_ERROR - << "DBUS response error " << ec; + << "DBUS response error " << ec2; messages::internalError(aResp->res); return; } @@ -368,15 +368,15 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp, auto getCpuPresenceState = [aResp]( const boost::system::error_code - ec, + ec3, const std::variant<bool>& cpuPresenceCheck) { - if (ec) + if (ec3) { BMCWEB_LOG_ERROR << "DBUS response " "error " - << ec; + << ec3; return; } modifyCpuPresenceState( @@ -386,15 +386,15 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp, auto getCpuFunctionalState = [aResp]( const boost::system::error_code - ec, + ec3, const std::variant<bool>& cpuFunctionalCheck) { - if (ec) + if (ec3) { BMCWEB_LOG_ERROR << "DBUS response " "error " - << ec; + << ec3; return; } modifyCpuFunctionalState( @@ -445,14 +445,14 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp, << "Found UUID, now get its properties."; crow::connections::systemBus->async_method_call( [aResp]( - const boost::system::error_code ec, + const boost::system::error_code ec3, const std::vector< std::pair<std::string, VariantType>>& properties) { - if (ec) + if (ec3) { BMCWEB_LOG_DEBUG - << "DBUS response error " << ec; + << "DBUS response error " << ec3; messages::internalError(aResp->res); return; } @@ -496,11 +496,11 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp, { crow::connections::systemBus->async_method_call( [aResp]( - const boost::system::error_code ec, + const boost::system::error_code ec2, const std::vector< std::pair<std::string, VariantType>>& propertiesList) { - if (ec) + if (ec2) { // doesn't have to include this // interface @@ -544,9 +544,9 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp, crow::connections::systemBus->async_method_call( [aResp]( - const boost::system::error_code ec, + const boost::system::error_code ec2, const std::variant<std::string>& property) { - if (ec) + if (ec2) { // doesn't have to include this // interface @@ -1004,11 +1004,11 @@ inline void getAutomaticRetry(std::shared_ptr<AsyncResp> aResp) // If AutomaticRetry (AutoReboot) is enabled see how many // attempts are left crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec, + [aResp](const boost::system::error_code ec2, std::variant<uint32_t>& autoRebootAttemptsLeft) { - if (ec) + if (ec2) { - BMCWEB_LOG_DEBUG << "D-BUS response error " << ec; + BMCWEB_LOG_DEBUG << "D-BUS response error " << ec2; return; } @@ -1660,8 +1660,8 @@ class SystemsCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); res.jsonValue["@odata.type"] = @@ -1671,25 +1671,22 @@ class SystemsCollection : public Node crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec, - const std::variant<std::string>& hostName) { + const std::variant<std::string>& /*hostName*/) { nlohmann::json& iface_array = asyncResp->res.jsonValue["Members"]; iface_array = nlohmann::json::array(); auto& count = asyncResp->res.jsonValue["Members@odata.count"]; count = 0; - if (ec) + iface_array.push_back( + {{"@odata.id", "/redfish/v1/Systems/system"}}); + if (!ec) { + BMCWEB_LOG_DEBUG << "Hypervisor is available"; iface_array.push_back( - {{"@odata.id", "/redfish/v1/Systems/system"}}); + {{"@odata.id", "/redfish/v1/Systems/hypervisor"}}); count = iface_array.size(); return; } - BMCWEB_LOG_DEBUG << "Hypervisor is available"; - iface_array.push_back( - {{"@odata.id", "/redfish/v1/Systems/system"}}); - iface_array.push_back( - {{"@odata.id", "/redfish/v1/Systems/hypervisor"}}); - count = iface_array.size(); }, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/network/hypervisor", @@ -1718,7 +1715,7 @@ class SystemActionsReset : public Node * Analyzes POST body message before sends Reset request data to D-Bus. */ void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -1883,8 +1880,8 @@ class Systems : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue["@odata.type"] = "#ComputerSystem.v1_12_0.ComputerSystem"; res.jsonValue["Name"] = "system"; @@ -1971,7 +1968,7 @@ class Systems : public Node } void doPatch(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::optional<std::string> indicatorLed; std::optional<nlohmann::json> bootProps; @@ -2065,8 +2062,8 @@ class SystemResetActionInfo : public Node /** * Functions triggers appropriate requests on DBus */ - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { res.jsonValue = { {"@odata.type", "#ActionInfo.v1_1_2.ActionInfo"}, diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp index d6c479f069..f7f0ff9eb8 100644 --- a/redfish-core/lib/task.hpp +++ b/redfish-core/lib/task.hpp @@ -258,7 +258,7 @@ class TaskMonitor : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -314,7 +314,7 @@ class Task : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { auto asyncResp = std::make_shared<AsyncResp>(res); @@ -388,8 +388,8 @@ class TaskCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); asyncResp->res.jsonValue["@odata.type"] = @@ -428,8 +428,8 @@ class TaskService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { auto asyncResp = std::make_shared<AsyncResp>(res); asyncResp->res.jsonValue["@odata.type"] = diff --git a/redfish-core/lib/thermal.hpp b/redfish-core/lib/thermal.hpp index 84cef2b2ae..8e01bee1bf 100644 --- a/redfish-core/lib/thermal.hpp +++ b/redfish-core/lib/thermal.hpp @@ -37,7 +37,7 @@ class Thermal : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { if (params.size() != 1) diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index c695a9bed2..a0fd252011 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -391,7 +391,7 @@ class UpdateServiceActionsSimpleUpdate : public Node private: void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { std::optional<std::string> transferProtocol; std::string imageURI; @@ -518,8 +518,8 @@ class UpdateService : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> aResp = std::make_shared<AsyncResp>(res); res.jsonValue["@odata.type"] = "#UpdateService.v1_4_0.UpdateService"; @@ -580,7 +580,7 @@ class UpdateService : public Node } void doPatch(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { BMCWEB_LOG_DEBUG << "doPatch..."; @@ -660,7 +660,7 @@ class UpdateService : public Node } void doPost(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + const std::vector<std::string>&) override { BMCWEB_LOG_DEBUG << "doPost..."; @@ -698,8 +698,8 @@ class SoftwareInventoryCollection : public Node } private: - void doGet(crow::Response& res, const crow::Request& req, - const std::vector<std::string>& params) override + void doGet(crow::Response& res, const crow::Request&, + const std::vector<std::string>&) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); res.jsonValue["@odata.type"] = @@ -797,7 +797,7 @@ class SoftwareInventory : public Node } } - void doGet(crow::Response& res, const crow::Request& req, + void doGet(crow::Response& res, const crow::Request&, const std::vector<std::string>& params) override { std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp index b626f5b0a2..922ac47659 100644 --- a/src/webserver_main.cpp +++ b/src/webserver_main.cpp @@ -60,7 +60,7 @@ inline void setupSocket(crow::App& app) } } -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { crow::logger::setLogLevel(crow::LogLevel::Debug); |