Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
fix(configuration/service): Bug fixed in service configurations lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
bouda1 committed Oct 29, 2019
1 parent cfd6511 commit 39447a5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 41 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_directories("${INC_DIR}/compatibility")
# Version.
set(CENTREON_ENGINE_MAJOR 19)
set(CENTREON_ENGINE_MINOR 10)
set(CENTREON_ENGINE_PATCH 2)
set(CENTREON_ENGINE_PATCH 3)
if (CENTREON_ENGINE_PRERELEASE)
set(CENTREON_ENGINE_VERSION "${CENTREON_ENGINE_MAJOR}.${CENTREON_ENGINE_MINOR}.${CENTREON_ENGINE_PATCH}-${CENTREON_ENGINE_PRERELEASE}")
else ()
Expand Down
12 changes: 12 additions & 0 deletions doc/release_notes/engine19.10.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
=======================
Centreon Engine 19.10.3
=======================

*********
Bug fixes
*********

Service escalation not well resolved
====================================
Service configurations look up failed when service escalations were defined.

=======================
Centreon Engine 19.10.2
=======================
Expand Down
2 changes: 0 additions & 2 deletions inc/com/centreon/engine/configuration/state.hh
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ namespace configuration {
servicegroups_find(servicegroup::key_type const& k);
set_service const& services() const throw ();
set_service& services() throw ();
set_service::const_iterator
services_find(service::key_type const& k) const;
set_service::iterator
services_find(service::key_type const& k);
set_service::const_iterator
Expand Down
44 changes: 6 additions & 38 deletions src/configuration/state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2954,31 +2954,6 @@ set_service& state::services() throw () {
return _services;
}

/**
* Get service by its key.
*
* @param[in] k Service name.
*
* @return Iterator to the element if found, services().end()
* otherwise.
*/
set_service::const_iterator state::services_find(
service::key_type const& k) const {
configuration::service below_searched;
below_searched.set_host_id(k.first);
below_searched.set_service_id(k.second);
set_service::const_iterator it{_services.upper_bound(below_searched)};
if (it != _services.end()
&& it->host_id() == k.first
&& it->service_id() == k.second)
return it;
else if (it != _services.begin()
&& (--it)->host_id() == k.first
&& it->service_id() == k.second)
return it;
return _services.end();
}

/**
* Get service by its key.
*
Expand Down Expand Up @@ -3006,19 +2981,12 @@ set_service::iterator state::services_find(

set_service::const_iterator state::services_find(
std::string const& host_name, std::string const& service_desc) const {
configuration::service below_searched;
below_searched.hosts().insert(host_name);
below_searched.service_description() = service_desc;
set_service::iterator
it(_services.upper_bound(below_searched));
if (it != _services.end()
&& *it->hosts().begin() == host_name
&& it->service_description() == service_desc)
return it;
else if (it != _services.begin()
&& *(--it)->hosts().begin() == host_name
&& it->service_description() == service_desc)
return it;
for (auto it = _services.begin(), end = _services.end();
it != end; ++it) {
if (it->service_description() == service_desc
&& *it->hosts().begin() == host_name)
return it;
}
return _services.end();
}

Expand Down

0 comments on commit 39447a5

Please sign in to comment.