Skip to content

Commit

Permalink
Merge branch 'feature/zone_checksum-for-endpoints-11' into 'feature/r…
Browse files Browse the repository at this point in the history
…edis'

RedisWriter: dump zone_checksum for endpoints

Closes #11

See merge request icingadb/icinga2!2
  • Loading branch information
Michael Friedrich authored and Al2Klimov committed Jul 27, 2018
2 parents d8af130 + f18a065 commit 05f9983
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/redis/rediswriter-objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,21 @@ void RedisWriter::SendConfigUpdate(const ConfigObject::Ptr& object, bool useTran
checkSums->Set("name_checksum", CalculateCheckSumString(object->GetShortName()));
checkSums->Set("environment_checksum", CalculateCheckSumString(GetEnvironment()));

/* 'zone' is available for all config objects, therefore calculate the checksum. */
Zone::Ptr zone = static_pointer_cast<Zone>(object->GetZone());
auto endpoint (dynamic_pointer_cast<Endpoint>(object));

if (zone)
checkSums->Set("zone_checksum", GetIdentifier(zone));
if (endpoint) {
auto endpointZone (endpoint->GetZone());

if (endpointZone) {
checkSums->Set("zone_checksum", GetIdentifier(endpointZone));
}
} else {
/* 'zone' is available for all config objects, therefore calculate the checksum. */
auto zone (dynamic_pointer_cast<Zone>(object->GetZone()));

if (zone)
checkSums->Set("zone_checksum", GetIdentifier(zone));
}

User::Ptr user = dynamic_pointer_cast<User>(object);

Expand Down

0 comments on commit 05f9983

Please sign in to comment.