parent_affecting_logging: a config object affects everything functionally depending on it

This commit is contained in:
Alexander A. Klimov 2023-08-14 18:57:51 +02:00
parent 8c3b6adaec
commit f98b5c5d7c
5 changed files with 18 additions and 6 deletions

View File

@ -34,12 +34,12 @@ class Comment : ConfigObject < CommentNameComposer
load_after Host;
load_after Service;
[config, no_user_modify, protected, required, navigation(host)] name(Host) host_name {
[config, no_user_modify, protected, required, navigation(host), parent_affecting_logging] name(Host) host_name {
navigate {{{
return Host::GetByName(GetHostName());
}}}
};
[config, no_user_modify, protected, navigation(service)] String service_name {
[config, no_user_modify, protected, navigation(service), parent_affecting_logging] String service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);

View File

@ -50,13 +50,13 @@ class Dependency : CustomVarObject < DependencyNameComposer
}}}
};
[config, no_user_modify, required, navigation(parent_host)] name(Host) parent_host_name {
[config, no_user_modify, required, navigation(parent_host), parent_affecting_logging] name(Host) parent_host_name {
navigate {{{
return Host::GetByName(GetParentHostName());
}}}
};
[config, no_user_modify, navigation(parent_service)] String parent_service_name {
[config, no_user_modify, navigation(parent_service), parent_affecting_logging] String parent_service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetParentHostName(), oldValue);

View File

@ -167,6 +167,17 @@ void Downtime::Stop(bool runtimeRemoved)
ObjectImpl<Downtime>::Stop(runtimeRemoved);
}
void Downtime::GetParentsAffectingLogging(std::vector<ConfigObject::Ptr>& output) const
{
ObjectImpl<Downtime>::GetParentsAffectingLogging(output);
auto object (ConfigObject::GetObject<ScheduledDowntime>(GetConfigOwner()));
if (object) {
output.emplace_back(std::move(object));
}
}
void Downtime::Pause()
{
if (m_CleanupTimer) {

View File

@ -78,6 +78,7 @@ public:
protected:
void Start(bool runtimeCreated) override;
void Stop(bool runtimeRemoved) override;
void GetParentsAffectingLogging(std::vector<ConfigObject::Ptr>& output) const override;
void Pause() override;
void Resume() override;

View File

@ -25,12 +25,12 @@ class Downtime : ConfigObject < DowntimeNameComposer
load_after Host;
load_after Service;
[config, no_user_modify, required, navigation(host)] name(Host) host_name {
[config, no_user_modify, required, navigation(host), parent_affecting_logging] name(Host) host_name {
navigate {{{
return Host::GetByName(GetHostName());
}}}
};
[config, no_user_modify, navigation(service)] String service_name {
[config, no_user_modify, navigation(service), parent_affecting_logging] String service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);