depot_deploy: support heartbeat in deploy config

Issue #3575
This commit is contained in:
Sid Hussmann 2019-12-05 15:10:57 +01:00 committed by Christian Helmuth
parent 9d7a58f6a7
commit 7676f47540
2 changed files with 23 additions and 0 deletions

View File

@ -400,6 +400,13 @@ void Depot_deploy::Child::gen_start_node(Xml_generator &xml, Xml_node common,
/* runtime handling */
Xml_node const runtime = _pkg_xml->xml().sub_node("runtime");
/*
* Insert inline '<heartbeat>' node if provided by the start node.
*/
if (_start_xml->xml().has_sub_node("heartbeat")) {
_gen_copy_of_sub_node(xml, _start_xml->xml(), "heartbeat");
}
/*
* Insert inline '<config>' node if provided by the start node,
* the launcher definition (if a launcher is user), or the

View File

@ -74,9 +74,25 @@ struct Depot_deploy::Main
/* generate init config containing all configured start nodes */
_init_config_reporter.generate([&] (Xml_generator &xml) {
Xml_node static_config = config.sub_node("static");
static_config.with_raw_content([&] (char const *start, size_t length) {
xml.append(start, length); });
config.with_sub_node("report", [&] (Xml_node const &report) {
size_t const delay_ms = report.attribute_value("delay_ms", 1000UL);
xml.node("report", [&] () {
xml.attribute("delay_ms", delay_ms);
});
});
config.with_sub_node("heartbeat", [&] (Xml_node const &heartbeat) {
size_t const rate_ms = heartbeat.attribute_value("rate_ms", 2000UL);
xml.node("heartbeat", [&] () {
xml.attribute("rate_ms", rate_ms);
});
});
Child::Depot_rom_server const parent { };
_children.gen_start_nodes(xml, config.sub_node("common_routes"),
parent, parent);