Clang-format cleanup
It looks like some of the code reviews in progress contain clang-format
fixes as well.
This squashes all of the clang-format fixes into a single commit, that
hopefully can go through the process a little faster, as it should only
be whitespace changes.
In the past, clang-formatting the naughty strings file proved
to return inconsistent results, and even formatted files would still be
detected as unformatted. Aparently the solution was to run
clang-format-5.0 approximately 20 times in a loop, until it decided on
a code layout that it was ok with iteration to iteration.
This is a bit of a corner case, so I don't think we need to get CI
running multiple runs in the future, and can just handle this on a case
by case basis. I'd be surprised if anyone else had this issue.
Change-Id: I57e2a03676bce20dc376fd9cea724732b2dc7010
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/redfish-core/include/node.hpp b/redfish-core/include/node.hpp
index ebd8989..20d2951 100644
--- a/redfish-core/include/node.hpp
+++ b/redfish-core/include/node.hpp
@@ -74,14 +74,14 @@
void getSubRoutes(const std::vector<std::unique_ptr<Node>>& allNodes) {
const std::string* url = getUrl();
if (url == nullptr) {
- //BMCWEB_LOG_CRITICAL << "Unable to get url for route";
+ // BMCWEB_LOG_CRITICAL << "Unable to get url for route";
return;
}
for (const auto& node : allNodes) {
const std::string* route = node->getUrl();
if (route == nullptr) {
- //BMCWEB_LOG_CRITICAL << "Unable to get url for route";
+ // BMCWEB_LOG_CRITICAL << "Unable to get url for route";
continue;
}
if (boost::starts_with(*route, *url)) {
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 4c44527..aa8d66f 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -390,17 +390,18 @@
const std::string &name,
const std::string &newValue,
const std::shared_ptr<AsyncResp> &asyncResp) {
- auto callback =
- [asyncResp, ipIdx{std::move(ipIdx)}, name{std::move(name)},
- newValue{std::move(newValue)}](const boost::system::error_code ec) {
- if (ec) {
- messages::addMessageToJson(
- asyncResp->res.jsonValue, messages::internalError(),
- "/IPv4Addresses/" + std::to_string(ipIdx) + "/" + name);
- } else {
- asyncResp->res.jsonValue["IPv4Addresses"][ipIdx][name] = newValue;
- }
- };
+ auto callback = [
+ asyncResp, ipIdx{std::move(ipIdx)}, name{std::move(name)},
+ newValue{std::move(newValue)}
+ ](const boost::system::error_code ec) {
+ if (ec) {
+ messages::addMessageToJson(
+ asyncResp->res.jsonValue, messages::internalError(),
+ "/IPv4Addresses/" + std::to_string(ipIdx) + "/" + name);
+ } else {
+ asyncResp->res.jsonValue["IPv4Addresses"][ipIdx][name] = newValue;
+ }
+ };
crow::connections::systemBus->async_method_call(
std::move(callback), "xyz.openbmc_project.Network",
@@ -428,17 +429,17 @@
const std::string &newValueDbus,
const std::shared_ptr<AsyncResp> &asyncResp) {
auto callback =
- [asyncResp, ipIdx{std::move(ipIdx)},
- newValue{std::move(newValue)}](const boost::system::error_code ec) {
- if (ec) {
- messages::addMessageToJson(
- asyncResp->res.jsonValue, messages::internalError(),
- "/IPv4Addresses/" + std::to_string(ipIdx) + "/AddressOrigin");
- } else {
- asyncResp->res.jsonValue["IPv4Addresses"][ipIdx]["AddressOrigin"] =
- newValue;
- }
- };
+ [ asyncResp, ipIdx{std::move(ipIdx)},
+ newValue{std::move(newValue)} ](const boost::system::error_code ec) {
+ if (ec) {
+ messages::addMessageToJson(
+ asyncResp->res.jsonValue, messages::internalError(),
+ "/IPv4Addresses/" + std::to_string(ipIdx) + "/AddressOrigin");
+ } else {
+ asyncResp->res.jsonValue["IPv4Addresses"][ipIdx]["AddressOrigin"] =
+ newValue;
+ }
+ };
crow::connections::systemBus->async_method_call(
std::move(callback), "xyz.openbmc_project.Network",
@@ -464,9 +465,9 @@
const std::string &ifaceId, int ipIdx, const std::string &ipHash,
const std::string &newValueStr, uint8_t &newValue,
const std::shared_ptr<AsyncResp> &asyncResp) {
- auto callback = [asyncResp, ipIdx{std::move(ipIdx)},
- newValueStr{std::move(newValueStr)}](
- const boost::system::error_code ec) {
+ auto callback = [
+ asyncResp, ipIdx{std::move(ipIdx)}, newValueStr{std::move(newValueStr)}
+ ](const boost::system::error_code ec) {
if (ec) {
messages::addMessageToJson(
asyncResp->res.jsonValue, messages::internalError(),
@@ -533,8 +534,8 @@
unsigned int ipIdx,
const std::shared_ptr<AsyncResp> &asyncResp) {
crow::connections::systemBus->async_method_call(
- [ipIdx{std::move(ipIdx)},
- asyncResp{std::move(asyncResp)}](const boost::system::error_code ec) {
+ [ ipIdx{std::move(ipIdx)}, asyncResp{std::move(asyncResp)} ](
+ const boost::system::error_code ec) {
if (ec) {
messages::addMessageToJson(
asyncResp->res.jsonValue, messages::internalError(),
@@ -562,15 +563,15 @@
uint8_t subnetMask, const std::string &gateway,
const std::string &address,
const std::shared_ptr<AsyncResp> &asyncResp) {
- auto createIpHandler =
- [ipIdx{std::move(ipIdx)},
- asyncResp{std::move(asyncResp)}](const boost::system::error_code ec) {
- if (ec) {
- messages::addMessageToJson(
- asyncResp->res.jsonValue, messages::internalError(),
- "/IPv4Addresses/" + std::to_string(ipIdx) + "/");
- }
- };
+ auto createIpHandler = [
+ ipIdx{std::move(ipIdx)}, asyncResp{std::move(asyncResp)}
+ ](const boost::system::error_code ec) {
+ if (ec) {
+ messages::addMessageToJson(
+ asyncResp->res.jsonValue, messages::internalError(),
+ "/IPv4Addresses/" + std::to_string(ipIdx) + "/");
+ }
+ };
crow::connections::systemBus->async_method_call(
std::move(createIpHandler), "xyz.openbmc_project.Network",
@@ -640,10 +641,11 @@
void getEthernetIfaceData(const std::string ðifaceId,
CallbackFunc &&callback) {
crow::connections::systemBus->async_method_call(
- [this, ethifaceId{std::move(ethifaceId)},
- callback{std::move(callback)}](
- const boost::system::error_code error_code,
- const GetManagedObjectsType &resp) {
+ [
+ this, ethifaceId{std::move(ethifaceId)}, callback{std::move(callback)}
+ ](const boost::system::error_code error_code,
+ const GetManagedObjectsType &resp) {
+
EthernetInterfaceData ethData{};
std::vector<IPv4AddressData> ipv4Data;
ipv4Data.reserve(maxIpV4AddressesPerInterface);
@@ -693,7 +695,7 @@
template <typename CallbackFunc>
void getEthernetIfaceList(CallbackFunc &&callback) {
crow::connections::systemBus->async_method_call(
- [this, callback{std::move(callback)}](
+ [ this, callback{std::move(callback)} ](
const boost::system::error_code error_code,
GetManagedObjectsType &resp) {
// Callback requires vector<string> to retrieve all available ethernet
@@ -776,27 +778,26 @@
std::string managerId = "openbmc";
// get eth interface list, and call the below callback for JSON preparation
- ethernetProvider.getEthernetIfaceList(
- [&, managerId{std::move(managerId)}](
- const bool &success, const std::vector<std::string> &iface_list) {
- if (success) {
- nlohmann::json ifaceArray = nlohmann::json::array();
- for (const std::string &ifaceItem : iface_list) {
- ifaceArray.push_back(
- {{"@odata.id", "/redfish/v1/Managers/" + managerId +
- "/EthernetInterfaces/" + ifaceItem}});
- }
- Node::json["Members"] = ifaceArray;
- Node::json["Members@odata.count"] = ifaceArray.size();
- Node::json["@odata.id"] =
- "/redfish/v1/Managers/" + managerId + "/EthernetInterfaces";
- res.jsonValue = Node::json;
- } else {
- // No success, best what we can do is return INTERNALL ERROR
- res.result(boost::beast::http::status::internal_server_error);
- }
- res.end();
- });
+ ethernetProvider.getEthernetIfaceList([&, managerId{std::move(managerId)} ](
+ const bool &success, const std::vector<std::string> &iface_list) {
+ if (success) {
+ nlohmann::json ifaceArray = nlohmann::json::array();
+ for (const std::string &ifaceItem : iface_list) {
+ ifaceArray.push_back(
+ {{"@odata.id", "/redfish/v1/Managers/" + managerId +
+ "/EthernetInterfaces/" + ifaceItem}});
+ }
+ Node::json["Members"] = ifaceArray;
+ Node::json["Members@odata.count"] = ifaceArray.size();
+ Node::json["@odata.id"] =
+ "/redfish/v1/Managers/" + managerId + "/EthernetInterfaces";
+ res.jsonValue = Node::json;
+ } else {
+ // No success, best what we can do is return INTERNALL ERROR
+ res.result(boost::beast::http::status::internal_server_error);
+ }
+ res.end();
+ });
}
// Ethernet Provider object
@@ -902,7 +903,7 @@
paramsJson["VLANId"] = inputVlanId;
OnDemandEthernetProvider::changeVlanId(
ifaceId, static_cast<uint32_t>(inputVlanId),
- [&, asyncResp, pathPrefx{std::move(pathPrefix)}](
+ [&, asyncResp, pathPrefx{std::move(pathPrefix)} ](
const boost::system::error_code ec) {
if (ec) {
messages::addMessageToJson(asyncResp->res.jsonValue,
@@ -914,7 +915,7 @@
} else if (inputVlanEnabled == false) {
// Disable VLAN
OnDemandEthernetProvider::disableVlan(
- ifaceId, [&, asyncResp, pathPrefx{std::move(pathPrefix)}](
+ ifaceId, [&, asyncResp, pathPrefx{std::move(pathPrefix)} ](
const boost::system::error_code ec) {
if (ec) {
messages::addMessageToJson(asyncResp->res.jsonValue,
@@ -1286,7 +1287,7 @@
// get single eth interface data, and call the below callback for JSON
// preparation
ethernetProvider.getEthernetIfaceData(
- ifaceId, [&, ifaceId, patchReq = std::move(patchReq)](
+ ifaceId, [&, ifaceId, patchReq = std::move(patchReq) ](
const bool &success, const EthernetInterfaceData ð_data,
const std::vector<IPv4AddressData> &ipv4_data) {
if (!success) {
@@ -1482,7 +1483,7 @@
// Get single eth interface data, and call the below callback for JSON
// preparation
ethernetProvider.getEthernetIfaceData(
- ifaceId, [&, parent_ifaceId, ifaceId, patchReq = std::move(patchReq)](
+ ifaceId, [&, parent_ifaceId, ifaceId, patchReq = std::move(patchReq) ](
const bool &success, const EthernetInterfaceData ð_data,
const std::vector<IPv4AddressData> &ipv4_data) {
if (!success) {
@@ -1644,47 +1645,45 @@
std::string rootInterfaceName = params[0];
// get eth interface list, and call the below callback for JSON preparation
- ethernetProvider.getEthernetIfaceList(
- [&, managerId{std::move(managerId)},
- rootInterfaceName{std::move(rootInterfaceName)}](
- const bool &success, const std::vector<std::string> &iface_list) {
- if (success) {
- bool rootInterfaceFound = false;
- nlohmann::json ifaceArray = nlohmann::json::array();
+ ethernetProvider.getEthernetIfaceList([
+ &, managerId{std::move(managerId)},
+ rootInterfaceName{std::move(rootInterfaceName)}
+ ](const bool &success, const std::vector<std::string> &iface_list) {
+ if (success) {
+ bool rootInterfaceFound = false;
+ nlohmann::json ifaceArray = nlohmann::json::array();
- for (const std::string &ifaceItem : iface_list) {
- if (ifaceItem == rootInterfaceName) {
- rootInterfaceFound = true;
- } else if (boost::starts_with(ifaceItem,
- rootInterfaceName + "_")) {
- ifaceArray.push_back(
- {{"@odata.id", "/redfish/v1/Managers/" + managerId +
- "/EthernetInterfaces/" +
- rootInterfaceName + "/VLANs/" +
- ifaceItem}});
- }
- }
-
- if (rootInterfaceFound) {
- Node::json["Members"] = ifaceArray;
- Node::json["Members@odata.count"] = ifaceArray.size();
- Node::json["@odata.id"] = "/redfish/v1/Managers/" + managerId +
- "/EthernetInterfaces/" +
- rootInterfaceName + "/VLANs";
- res.jsonValue = Node::json;
- } else {
- messages::addMessageToErrorJson(
- res.jsonValue, messages::resourceNotFound("EthernetInterface",
- rootInterfaceName));
- res.result(boost::beast::http::status::not_found);
- res.end();
- }
- } else {
- // No success, best what we can do is return INTERNALL ERROR
- res.result(boost::beast::http::status::internal_server_error);
+ for (const std::string &ifaceItem : iface_list) {
+ if (ifaceItem == rootInterfaceName) {
+ rootInterfaceFound = true;
+ } else if (boost::starts_with(ifaceItem, rootInterfaceName + "_")) {
+ ifaceArray.push_back(
+ {{"@odata.id", "/redfish/v1/Managers/" + managerId +
+ "/EthernetInterfaces/" + rootInterfaceName +
+ "/VLANs/" + ifaceItem}});
}
+ }
+
+ if (rootInterfaceFound) {
+ Node::json["Members"] = ifaceArray;
+ Node::json["Members@odata.count"] = ifaceArray.size();
+ Node::json["@odata.id"] = "/redfish/v1/Managers/" + managerId +
+ "/EthernetInterfaces/" + rootInterfaceName +
+ "/VLANs";
+ res.jsonValue = Node::json;
+ } else {
+ messages::addMessageToErrorJson(
+ res.jsonValue, messages::resourceNotFound("EthernetInterface",
+ rootInterfaceName));
+ res.result(boost::beast::http::status::not_found);
res.end();
- });
+ }
+ } else {
+ // No success, best what we can do is return INTERNALL ERROR
+ res.result(boost::beast::http::status::internal_server_error);
+ }
+ res.end();
+ });
}
void doPost(crow::Response &res, const crow::Request &req,
@@ -1719,49 +1718,49 @@
}
// get eth interface list, and call the below callback for JSON preparation
- ethernetProvider.getEthernetIfaceList(
- [&, managerId{std::move(managerId)},
- rootInterfaceName{std::move(rootInterfaceName)}](
- const bool &success, const std::vector<std::string> &iface_list) {
- if (success) {
- bool rootInterfaceFound = false;
+ ethernetProvider.getEthernetIfaceList([
+ &, managerId{std::move(managerId)},
+ rootInterfaceName{std::move(rootInterfaceName)}
+ ](const bool &success, const std::vector<std::string> &iface_list) {
+ if (success) {
+ bool rootInterfaceFound = false;
- for (const std::string &ifaceItem : iface_list) {
- if (ifaceItem == rootInterfaceName) {
- rootInterfaceFound = true;
- break;
- }
- }
-
- if (rootInterfaceFound) {
- ethernetProvider.createVlan(
- rootInterfaceName, vlanId,
- [&, vlanId, rootInterfaceName,
- req{std::move(req)}](const boost::system::error_code ec) {
- if (ec) {
- messages::addMessageToErrorJson(
- res.jsonValue, messages::internalError());
- res.end();
- } else {
- memberVlan.doGet(
- res, req,
- {rootInterfaceName,
- rootInterfaceName + "_" + std::to_string(vlanId)});
- }
- });
- } else {
- messages::addMessageToErrorJson(
- res.jsonValue, messages::resourceNotFound("EthernetInterface",
- rootInterfaceName));
- res.result(boost::beast::http::status::not_found);
- res.end();
- }
- } else {
- // No success, best what we can do is return INTERNALL ERROR
- res.result(boost::beast::http::status::internal_server_error);
- res.end();
+ for (const std::string &ifaceItem : iface_list) {
+ if (ifaceItem == rootInterfaceName) {
+ rootInterfaceFound = true;
+ break;
}
- });
+ }
+
+ if (rootInterfaceFound) {
+ ethernetProvider.createVlan(
+ rootInterfaceName, vlanId,
+ [&, vlanId, rootInterfaceName,
+ req{std::move(req)} ](const boost::system::error_code ec) {
+ if (ec) {
+ messages::addMessageToErrorJson(res.jsonValue,
+ messages::internalError());
+ res.end();
+ } else {
+ memberVlan.doGet(
+ res, req,
+ {rootInterfaceName,
+ rootInterfaceName + "_" + std::to_string(vlanId)});
+ }
+ });
+ } else {
+ messages::addMessageToErrorJson(
+ res.jsonValue, messages::resourceNotFound("EthernetInterface",
+ rootInterfaceName));
+ res.result(boost::beast::http::status::not_found);
+ res.end();
+ }
+ } else {
+ // No success, best what we can do is return INTERNALL ERROR
+ res.result(boost::beast::http::status::internal_server_error);
+ res.end();
+ }
+ });
}
// Ethernet Provider object
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 836249a..f1c3d92 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -116,7 +116,7 @@
};
BMCWEB_LOG_DEBUG << "Get available system components.";
crow::connections::systemBus->async_method_call(
- [name, aResp{std::move(aResp)}](
+ [ name, aResp{std::move(aResp)} ](
const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
@@ -146,7 +146,7 @@
BMCWEB_LOG_DEBUG << "Found name: " << name;
const std::string connectionName = connectionNames[0].first;
crow::connections::systemBus->async_method_call(
- [aResp, name(std::string(name))](
+ [ aResp, name(std::string(name)) ](
const boost::system::error_code ec,
const std::vector<std::pair<std::string, VariantType>>
&propertiesList) {
@@ -332,9 +332,9 @@
CallbackFunc &&callback) {
BMCWEB_LOG_DEBUG << "Get led groups";
crow::connections::systemBus->async_method_call(
- [aResp{std::move(aResp)}, &callback](
- const boost::system::error_code &ec,
- const ManagedObjectsType &resp) {
+ [
+ aResp{std::move(aResp)}, &callback
+ ](const boost::system::error_code &ec, const ManagedObjectsType &resp) {
if (ec) {
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
aResp->setErrorStatus();
@@ -372,8 +372,9 @@
CallbackFunc &&callback) {
BMCWEB_LOG_DEBUG << "Get identify led properties";
crow::connections::systemBus->async_method_call(
- [aResp{std::move(aResp)}, &callback](const boost::system::error_code ec,
- const PropertiesType &properties) {
+ [ aResp{std::move(aResp)}, &callback ](
+ const boost::system::error_code ec,
+ const PropertiesType &properties) {
if (ec) {
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
aResp->setErrorStatus();
@@ -645,7 +646,7 @@
// Update led group
BMCWEB_LOG_DEBUG << "Update led group.";
crow::connections::systemBus->async_method_call(
- [&, asyncResp{std::move(asyncResp)}](
+ [&, asyncResp{std::move(asyncResp)} ](
const boost::system::error_code ec) {
if (ec) {
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -663,7 +664,7 @@
// Update identify led status
BMCWEB_LOG_DEBUG << "Update led SoftwareInventoryCollection.";
crow::connections::systemBus->async_method_call(
- [&, asyncResp{std::move(asyncResp)}](
+ [&, asyncResp{std::move(asyncResp)} ](
const boost::system::error_code ec) {
if (ec) {
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;