MCPcopy Create free account
hub / github.com/Icinga/icinga2 / SendConfigDelete

Method SendConfigDelete

lib/icingadb/icingadb-objects.cpp:1793–1853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1791}
1792
1793void IcingaDB::SendConfigDelete(const ConfigObject::Ptr& object)
1794{
1795 if (!m_RconWorker || !m_RconWorker->IsConnected())
1796 return;
1797
1798 if (auto customVarObject = dynamic_pointer_cast<CustomVarObject>(object); customVarObject) {
1799 SendCustomVarsChanged(object, customVarObject->GetVars(), nullptr);
1800 }
1801
1802 Type::Ptr type = object->GetReflectionType();
1803 if (type == Host::TypeInstance || type == Service::TypeInstance) {
1804 Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
1805
1806 Host::Ptr host;
1807 Service::Ptr service;
1808 tie(host, service) = GetHostService(checkable);
1809
1810 auto [configStateKey, checksumStateKey] = GetCheckableStateKeys(checkable->GetReflectionType());
1811 EnqueueRelationsDeletion(GetObjectIdentifier(checkable), {{configStateKey, checksumStateKey}});
1812 EnqueueConfigObject(object, icingadb::task_queue::ConfigDelete | icingadb::task_queue::NextUpdate); // Send also ZREM for next update
1813
1814 if (service) {
1815 SendGroupsChanged<ServiceGroup>(checkable, service->GetGroups(), nullptr);
1816 } else {
1817 SendGroupsChanged<HostGroup>(checkable, host->GetGroups(), nullptr);
1818 }
1819
1820 return;
1821 }
1822
1823 EnqueueConfigObject(object, icingadb::task_queue::ConfigDelete);
1824
1825 if (type == TimePeriod::TypeInstance) {
1826 TimePeriod::Ptr timeperiod = static_pointer_cast<TimePeriod>(object);
1827 SendTimePeriodRangesChanged(timeperiod, timeperiod->GetRanges(), nullptr);
1828 SendTimePeriodIncludesChanged(timeperiod, timeperiod->GetIncludes(), nullptr);
1829 SendTimePeriodExcludesChanged(timeperiod, timeperiod->GetExcludes(), nullptr);
1830 return;
1831 }
1832
1833 if (type == User::TypeInstance) {
1834 User::Ptr user = static_pointer_cast<User>(object);
1835 SendGroupsChanged<UserGroup>(user, user->GetGroups(), nullptr);
1836 return;
1837 }
1838
1839 if (type == Notification::TypeInstance) {
1840 Notification::Ptr notification = static_pointer_cast<Notification>(object);
1841 SendNotificationUsersChanged(notification, notification->GetUsersRaw(), nullptr);
1842 SendNotificationUserGroupsChanged(notification, notification->GetUserGroupsRaw(), nullptr);
1843 return;
1844 }
1845
1846 if (type == CheckCommand::TypeInstance || type == NotificationCommand::TypeInstance || type == EventCommand::TypeInstance) {
1847 Command::Ptr command = static_pointer_cast<Command>(object);
1848 const auto& cmdRedisKeys = GetCmdEnvArgKeys(command->GetReflectionType());
1849 SendCommandArgumentsChanged(command, cmdRedisKeys, command->GetArguments(), nullptr);
1850 SendCommandEnvChanged(command, cmdRedisKeys, command->GetEnv(), nullptr);

Callers 1

VersionChangedHandlerMethod · 0.80

Calls 3

IsConnectedMethod · 0.80
GetEnvMethod · 0.80
GetReflectionTypeMethod · 0.45

Tested by

no test coverage detected