entity-manager: extract postBoardToDBus function
Extract postBoardToDBus from postToDbus function.
The function was really huge and not suitable for further development.
Extracting the loop body is a logical choice and already removes one
level of indentation.
What's been changed:
- extract the function
- change one 'continue' statement to a 'return' statement, preserving
the original control flow.
Tested: on Tyan S8030
Checked that `busctl tree` looks as before
```
`- /xyz
`- /xyz/openbmc_project
|- /xyz/openbmc_project/EntityManager
`- /xyz/openbmc_project/inventory
`- /xyz/openbmc_project/inventory/system
|- /xyz/openbmc_project/inventory/system/board
| `- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/CPU0_Power_Consumption
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/CPU0_Temp
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/GARBO_SENSOR
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/P0_VDD_18_RUN
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/P0_VDD_CORE_RUN
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/P0_VDD_MEM_ABCD
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/P0_VDD_MEM_EFGH
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/P0_VDD_SOC_RUN
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/VBAT_33
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/VDD_12_RUN
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/VDD_33_DUAL
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/VDD_33_RUN
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/VDD_5_DUAL
| |- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/VDD_5_RUN
| `- /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/X550
|- /xyz/openbmc_project/inventory/system/chassis
| `- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/Fan_Control
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/NIC_1_Ignore
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/NIC_2_Ignore
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/NIC_FRU_1
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/NIC_FRU_2
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/SYS_FAN_1
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/SYS_FAN_2
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/SYS_FAN_3
| |- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/Temperature_Control
| `- /xyz/openbmc_project/inventory/system/chassis/MBX_1_57_Chassis/Zone0
`- /xyz/openbmc_project/inventory/system/powersupply
|- /xyz/openbmc_project/inventory/system/powersupply/Supermicro_PWS_920P_SQ_0
| |- /xyz/openbmc_project/inventory/system/powersupply/Supermicro_PWS_920P_SQ_0/PSU0
| |- /xyz/openbmc_project/inventory/system/powersupply/Supermicro_PWS_920P_SQ_0/PSU0_ADDR
| `- /xyz/openbmc_project/inventory/system/powersupply/Supermicro_PWS_920P_SQ_0/PSU0_FRU
`- /xyz/openbmc_project/inventory/system/powersupply/Supermicro_PWS_920P_SQ_1
|- /xyz/openbmc_project/inventory/system/powersupply/Supermicro_PWS_920P_SQ_1/PSU1
|- /xyz/openbmc_project/inventory/system/powersupply/Supermicro_PWS_920P_SQ_1/PSU1_ADDR
`- /xyz/openbmc_project/inventory/system/powersupply/Supermicro_PWS_920P_SQ_1/PSU1_FRU
```
Checked some individual object paths, also appear same as before.
```
busctl introspect xyz.openbmc_project.EntityManager /xyz/openbmc_project/inventory/system/board/Tyan_S8030_Baseboard/VBAT_33
```
output:
```
...
xyz.openbmc_project.Configuration.ADC interface - - -
.Index property t 10 emits-change
.Name property s "VBAT_33" emits-change
.PowerState property s "Always" emits-change
.ScaleFactor property d 0.3333 emits-change
.Type property s "ADC" emits-change
xyz.openbmc_project.Configuration.ADC.Thresholds0 interface - - -
.Delete method - - -
.Direction property s "greater than" emits-change
.Name property s "upper critical" emits-change
.Severity property d 1 emits-change
.Value property d 3.507 emits-change
xyz.openbmc_project.Configuration.ADC.Thresholds1 interface - - -
.Delete method - - -
.Direction property s "less than" emits-change
.Name property s "lower critical" emits-change
.Severity property d 1 emits-change
.Value property d 2.688 emits-change
```
Change-Id: I518d8d03e8a4f24c45deb12f9dc2069523dee987
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/entity_manager.hpp b/src/entity_manager/entity_manager.hpp
index d2bce67..70436f5 100644
--- a/src/entity_manager/entity_manager.hpp
+++ b/src/entity_manager/entity_manager.hpp
@@ -51,6 +51,10 @@
boost::asio::steady_timer& timer,
nlohmann::json newConfiguration);
void postToDbus(const nlohmann::json& newConfiguration);
+ void postBoardToDBus(const std::string& boardId,
+ const nlohmann::json& boardConfig,
+ std::map<std::string, std::string>& newBoards);
+
void pruneConfiguration(bool powerOff, const std::string& name,
const nlohmann::json& device);