44 Commits

Author SHA1 Message Date
Julian Brost
065118bc22 Make DependencyGroup::State an enum
The previous struct used two bools to represent three useful states. Make this
more explicit by having these three states as an enum.
2025-03-19 16:28:00 +01:00
Julian Brost
693d094ebc DependencyGroup: don't change the keys of m_Members after construction
This prevents the use of DependencyGroup for storing the dependencies during
the early registration (m_DependencyGroupsPushedToRegistry = false),
m_PendingDependencies is introduced as a replacement to store the dependencies
at that time.
2025-03-19 16:28:00 +01:00
Yonas Habteab
7fbb8f7452 Evaluate dependency group state only for a specific child
Previously the dependency state was evaluated by picking the first
dependency object from the batched members. However, since the
dependency `disable_{checks,notifications` attributes aren't taken into
account when batching the members, the evaluated state may yield a wrong
result for some Checkables due to some random dependency from other
Checkable of that group that has the `disable_{checks,notifications`
attrs set. This commit forces the callers to always provide the child
Checkable the state is evaluated for and picks only the dependency
objects of that child Checkable.
2025-03-19 16:28:00 +01:00
Julian Brost
ce1ed8556c Simplify DependencyGroup::GetState() implementation
The new implementation just counts reachable and available parents and
determines the overall result by comparing numbers, see inline comments for
more information.

This also fixes an issue in the previous implementation: if it didn't return
early from the loop, it would just return the state of the last parent
considered which may not actually represent the group state accurately.
2025-03-19 16:28:00 +01:00
Yonas Habteab
8640a3f84e Checkable: Extract parents directly from dependency groups 2025-03-19 16:28:00 +01:00
Yonas Habteab
806fff950c Checkable: Emit boost signals when changing dependency groups at runtime 2025-03-19 16:28:00 +01:00
Yonas Habteab
67a4889945 Checkable: Delay dependency group global registration on startup 2025-03-19 16:28:00 +01:00
Julian Brost
26f46fe021 Simplify dependency group registration
Co-Authored-By: Yonas Habteab <yonas.habteab@icinga.com>
2025-03-19 16:28:00 +01:00
Yonas Habteab
f502993eb4 IcingaDB: Sync dependencies states to Redis 2025-03-19 16:28:00 +01:00
Yonas Habteab
1820955993 Add DependencyGroup::GetState() helper method 2025-03-12 16:31:14 +01:00
Yonas Habteab
d7c9e6687e Introduce DependencyGroup helper class 2025-03-12 16:31:12 +01:00
Julian Brost
8e7e687b96 Unify depependency cycle check code.
This commit removes a distinction in how dependency objects are checked for
cycles in the resulting graph depending on whether they are part of the
initially loaded configuration during process startup or as part of a runtime
update.

The DependencyCycleChecker helper class is extended with a mechanism that
allows additional dependencies to be considered during the cycle search. This
allows using it to check for cycles before actually registering the
dependencies with the checkables.

The aforementioned case-distinction for initial/runtime-update config is
removed by making use of the newly added BeforeOnAllConfigLoaded signal to
perform the cycle check at once for each batch of dependencies inside
ConfigItem::CommitNewItems() for both cases now. During the initial config
loading, there can be multiple batches of dependencies as objects from apply
rules are created separately, so parts of the dependency graph might be visited
multiple times now, however that is limited to a minimum as only parts of the
graph that are reachable from the newly added dependencies are searched.
2025-03-12 11:53:30 +01:00
Alexander A. Klimov
5b63407d15 Forbid dependency cycles 2023-02-06 12:33:48 +01:00
Alexander A. Klimov
a907c2ac9a Targeted apply rules: don't unnecessarily eval filter 2022-10-28 14:27:53 +02:00
Michael Friedrich
3a4fb840d4 Tests: Add multi parent dependency test case 2020-02-11 15:13:25 +01:00
Michael Friedrich
d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich
dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Gunnar Beutner
9d436605f0 Fix compatibility with CMake < 3.1 2018-01-18 15:12:46 +01:00
Gunnar Beutner
21254fb610 Avoid accessing attributes for validators where not necessary 2018-01-11 08:20:16 +01:00
Gunnar Beutner
9ca682496c Apply clang-tidy fix 'modernize-use-override' 2018-01-04 12:24:57 +01:00
Gunnar Beutner
ac155d1dda Apply clang-tidy fix 'modernize-redundant-void-arg' 2018-01-04 12:24:57 +01:00
Gunnar Beutner
efe99a3e5e Add the final keyword to classes 2018-01-04 05:20:20 +00:00
Gunnar Beutner
90496b5456 Build libraries as static libraries 2018-01-02 23:29:48 +01:00
Michael Insel
158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Michael Friedrich
b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Gunnar Beutner
b5b09216c6 Use lambda functions for INITIALIZE_ONCE
fixes #12562
2016-08-27 09:48:36 +02:00
Gunnar Beutner
599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Gunnar Beutner
050c520b2a Convert Comment/Downtime to config objects
fixes #9777
2015-10-28 17:56:29 +01:00
Gunnar Beutner
d118b71a2a Fix compiler warnings
fixes #9929
2015-08-18 07:46:04 +02:00
Gunnar Beutner
ec7224e3ed Generate C++ code for type validators
fixes #7709
fixes #8867
2015-03-27 07:59:27 +01:00
Gunnar Beutner
fb323ee215 Evaluate apply filters in the for loop
fixes #7610
2015-01-29 12:38:25 +01:00
Michael Friedrich
78bfd0204c Update copyright year 2015-01-22 12:00:23 +01:00
Gunnar Beutner
06052c0539 Fix validation for service names in Notification, Dependency and ScheduledDowntime objects
fixes #8122
2014-12-19 11:44:31 +01:00
Gunnar Beutner
55b7f00382 Remove unnecessary includes 2014-12-15 10:16:06 +01:00
Gunnar Beutner
cfd775c948 Move the VMFrame class to libbase
refs #8065
2014-12-12 15:33:56 +01:00
Gunnar Beutner
fddead5303 Fix some compiler warnings
fixes #7826
2014-11-24 18:25:08 +01:00
Gunnar Beutner
f5766f9118 Refactor the stack frame handling for scripts
fixes #7748
2014-11-22 19:24:03 +01:00
Gunnar Beutner
0078e00c13 Refactor apply/object rules
fixes #7700
2014-11-20 21:29:50 +01:00
Gunnar Beutner
2d53e000c8 Refactor the config validator so that it doesn't require serialized objects
refs #7701
2014-11-20 13:28:21 +01:00
Gunnar Beutner
478f03b49a Replace boost::shared_ptr with boost::intrusive_ptr
refs #7622
2014-11-09 16:54:41 +01:00
Gunnar Beutner
a1c905bf62 Implement dictionary support for apply+for
fixes #7561
2014-11-04 11:02:10 +01:00
Gunnar Beutner
170c5a59e4 Implement typeof() function 2014-11-03 00:45:14 +01:00
Gunnar Beutner
8d3632caf8 Cache parent and child object for dependencies
fixes #6565
2014-06-24 11:46:53 +02:00
Gunnar Beutner
632026cd9f Rename C++ header files.
Fixes #6291
2014-05-25 16:27:14 +02:00