control: Support switch to 'default_ceiling'
To remove the term `speed`, the 'full_speed' zone configuration
attribute will be replaced with the use of 'default_ceiling'. Currently
need to support both until the upstream configs are updated to
'default_ceiling' and merged.
Change-Id: I2aaee1183e25b4b57969762bb978a1b127a732c0
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/zone.cpp b/control/json/zone.cpp
index 8db1b4e..08aa91a 100644
--- a/control/json/zone.cpp
+++ b/control/json/zone.cpp
@@ -247,13 +247,21 @@
void Zone::setDefaultCeiling(const json& jsonObj)
{
- if (!jsonObj.contains("full_speed"))
+ // TODO Remove "full_speed" after configs replaced with "default_ceiling"
+ if (!jsonObj.contains("full_speed") && !jsonObj.contains("default_ceiling"))
{
- log<level::ERR>("Missing required zone's full speed",
+ log<level::ERR>("Missing required zone's default ceiling",
entry("JSON=%s", jsonObj.dump().c_str()));
- throw std::runtime_error("Missing required zone's full speed");
+ throw std::runtime_error("Missing required zone's default ceiling");
}
- _defaultCeiling = jsonObj["full_speed"].get<uint64_t>();
+ if (jsonObj.contains("full_speed"))
+ {
+ _defaultCeiling = jsonObj["full_speed"].get<uint64_t>();
+ }
+ else
+ {
+ _defaultCeiling = jsonObj["default_ceiling"].get<uint64_t>();
+ }
// Start with the current target set as the default
_target = _defaultCeiling;
// Start with the current ceiling set as the default