Skip to content

Commit

Permalink
fix(engine) : New config parser take account of pairstringpair and se…
Browse files Browse the repository at this point in the history
…rvicegroup inheritance
  • Loading branch information
sechkem committed Oct 29, 2024
1 parent 8adba50 commit f60d69b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions common/engine_conf/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,10 @@ void parser::_resolve_template(State* pb_config, error_cnt& err) {
_resolve_template(_pb_helper[&hg],
_pb_templates[message_helper::hostgroup]);

for (Servicegroup& sg : *pb_config->mutable_servicegroups())
_resolve_template(_pb_helper[&sg],
_pb_templates[message_helper::servicegroup]);

for (const Command& c : pb_config->commands())
_pb_helper.at(&c)->check_validity(err);

Expand Down Expand Up @@ -782,6 +786,25 @@ void parser::_merge(std::unique_ptr<message_helper>& msg_helper,
lst->add_data(v);
} else if (lst->data().empty())
*lst->mutable_data() = orig_lst->data();
} else if (d && d->name() == "PairStringSet") {
PairStringSet* orig_pair =
static_cast<PairStringSet*>(refl->MutableMessage(tmpl, f));
PairStringSet* pair =
static_cast<PairStringSet*>(refl->MutableMessage(msg, f));
if (pair->additive()) {
for (auto& v : orig_pair->data()) {
bool found = false;
for (auto& s : *pair->mutable_data()) {
if (s.first() == v.first() && s.second() == v.second()) {
found = true;
break;
}
}
if (!found)
pair->add_data()->CopyFrom(v);
}
} else if (pair->data().empty())
*pair->mutable_data() = orig_pair->data();
} else {
refl->MutableMessage(msg, f)->CopyFrom(
refl->GetMessage(*tmpl, f));
Expand Down

1 comment on commit f60d69b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
29 2 0 31 93.55 26m31.899139s

Failed Tests

Name Message ⏱️ Duration Suite
BEOTEL_CENTREON_AGENT_CHECK_NATIVE_CPU resources table not updated 145.309 s Cma
not12 The second notification of U2 is not sent 82.363 s Notifications

Please sign in to comment.