entity-manager: remove global io_context

Remove the global var
```
boost::asio::io_context io
```
and move it to be a local var in the main function.

Since boost::asio::io_context io is declared first, it in scope for the
entire program duration and should not cause any issues from that
perspective.

The io_context is passed through where needed. In case there is a class
already defined, the class now has a reference to the io_context to
avoid passing it through everywhere.

Tested: Capturing or passing a reference which is always valid should
not introduce any issues.

Tested on Tyan S8030:

```
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: Supermicro PWS 920P SQ 0
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: Supermicro PWS 920P SQ 1
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: chassis
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: MBX 1.57 Chassis
```

busctl tree output as before

Change-Id: Ie8f7d18c38d166c57a9cb645ab45c9103bbdff6e
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/dbus_interface.cpp b/src/entity_manager/dbus_interface.cpp
index 45c90fa..ff8094e 100644
--- a/src/entity_manager/dbus_interface.cpp
+++ b/src/entity_manager/dbus_interface.cpp
@@ -72,12 +72,12 @@
     const std::string& jsonPointerPath,
     const std::shared_ptr<sdbusplus::asio::dbus_interface>& iface,
     sdbusplus::asio::object_server& objServer,
-    nlohmann::json& systemConfiguration)
+    nlohmann::json& systemConfiguration, boost::asio::io_context& io)
 {
     std::weak_ptr<sdbusplus::asio::dbus_interface> interface = iface;
     iface->register_method(
         "Delete", [&objServer, &systemConfiguration, interface,
-                   jsonPointerPath{std::string(jsonPointerPath)}]() {
+                   jsonPointerPath{std::string(jsonPointerPath)}, &io]() {
             std::shared_ptr<sdbusplus::asio::dbus_interface> dbusInterface =
                 interface.lock();
             if (!dbusInterface)
@@ -203,7 +203,8 @@
 
 // adds simple json types to interface's properties
 void populateInterfaceFromJson(
-    nlohmann::json& systemConfiguration, const std::string& jsonPointerPath,
+    boost::asio::io_context& io, nlohmann::json& systemConfiguration,
+    const std::string& jsonPointerPath,
     std::shared_ptr<sdbusplus::asio::dbus_interface>& iface,
     nlohmann::json& dict, sdbusplus::asio::object_server& objServer,
     sdbusplus::asio::PropertyPermission permission)
@@ -238,14 +239,14 @@
     if (permission == sdbusplus::asio::PropertyPermission::readWrite)
     {
         createDeleteObjectMethod(jsonPointerPath, iface, objServer,
-                                 systemConfiguration);
+                                 systemConfiguration, io);
     }
     tryIfaceInitialize(iface);
 }
 
 void createAddObjectMethod(
-    const std::string& jsonPointerPath, const std::string& path,
-    nlohmann::json& systemConfiguration,
+    boost::asio::io_context& io, const std::string& jsonPointerPath,
+    const std::string& path, nlohmann::json& systemConfiguration,
     sdbusplus::asio::object_server& objServer, const std::string& board)
 {
     std::shared_ptr<sdbusplus::asio::dbus_interface> iface = createInterface(
@@ -255,8 +256,9 @@
         "AddObject",
         [&systemConfiguration, &objServer,
          jsonPointerPath{std::string(jsonPointerPath)}, path{std::string(path)},
-         board](const boost::container::flat_map<std::string, JsonVariantType>&
-                    data) {
+         board,
+         &io](const boost::container::flat_map<std::string, JsonVariantType>&
+                  data) {
             nlohmann::json::json_pointer ptr(jsonPointerPath);
             nlohmann::json& base = systemConfiguration[ptr];
             auto findExposes = base.find("Exposes");
@@ -363,7 +365,7 @@
             // permission is read-write, as since we just created it, must be
             // runtime modifiable
             populateInterfaceFromJson(
-                systemConfiguration,
+                io, systemConfiguration,
                 jsonPointerPath + "/Exposes/" + std::to_string(lastIndex),
                 interface, newData, objServer,
                 sdbusplus::asio::PropertyPermission::readWrite);