Commit Graph

13297 Commits

Author SHA1 Message Date
Alexander Aleksandrovič Klimov 90f2522d15
GHA: revert back to ubuntu-latest
as that is 22.04 or later.
2023-01-19 11:04:25 +01:00
Alexander Aleksandrovič Klimov a0286e9c64
Merge pull request #9606 from Icinga/initialize-once
INITIALIZE_ONCE_WITH_PRIORITY: use enum for priority values and use std::function
2023-01-18 21:10:58 +01:00
Julian Brost dfbb1e973c
Merge pull request #9625 from Icinga/buildx
GHA: handle changed interface of Icinga/docker-icinga2
2023-01-18 19:33:15 +01:00
Alexander Aleksandrovič Klimov ff8a29b03e
Merge pull request #9633 from Icinga/gha-drop-fedora-35
GitHub Actions: no longer test builds on Fedora 35
2023-01-18 16:23:01 +01:00
Julian Brost 6229f4d9bf InitializePriority: don't explicitly specify values
Now that all values are in one place, there is no reason for this numbering
with gaps anymore. If you need to insert a new value in between, you can just
do so in the enum.

This reverses the sort order of the enum, thereby requiring a change to the
sort order of the std::priority_queue containing the elements.
2023-01-18 15:57:32 +01:00
Julian Brost 99bb687350 INITIALIZE_ONCE_WITH_PRIORITY: use enum for priority values
Change the type of the priority values from int to a new enum. By replacing the
magic int values throughout the code base with named values, there is now a
single place where all priority values are defined and you get an overview over
the initialization order.
2023-01-18 15:57:27 +01:00
Julian Brost 61285adcae InitializeOnceHelper: use std::function instead of C function pointer
InitializeOnceHelper calls Loader::AddDeferredInitializer which takes a
std::function, so it's eventually converted to that anyways. This commit just
does this a bit earlier, and by saving the step of the intermediate C function
pointer, this would now also work for capturing lambdas (which there are none
of at the moment).
2023-01-18 15:52:42 +01:00
Julian Brost c019f8c04a
Merge pull request #9603 from Icinga/remove-namespace-behavior
Namespace: replace behavior classes with a bool
2023-01-18 15:48:34 +01:00
Julian Brost 3c2a8c98b6
Merge pull request #9045 from Icinga/feature/check_linux_netdev
ITL: add check_linux_netdev
2023-01-18 14:19:25 +01:00
Julian Brost a259650bea
Merge pull request #8595 from Icinga/bugfix/cluster-zone-own-zone-8570
cluster-zone: consider own zone connected if there's only one endpoint
2023-01-17 17:26:14 +01:00
Julian Brost ce5e6e7d13
Merge pull request #9041 from Icinga/Al2Klimov-patch-1
check_icmp: double packet loss thresholds
2023-01-17 15:15:46 +01:00
Julian Brost a258d90d93
GitHub Actions: no longer test builds on Fedora 35
The repositories have been removed so builds are failing anyways.
2023-01-17 15:14:53 +01:00
Julian Brost 06d0e7fbb9
Merge pull request #9611 from Icinga/8992
ITL: vmware: support --open_vm_tools_ok, --no_vm_tools_ok
2023-01-17 14:44:59 +01:00
Alexander A. Klimov 47de7a9e42 GHA: handle changed interface of Icinga/docker-icinga2 2023-01-16 17:38:32 +01:00
Alexander Aleksandrovič Klimov e628c73fb1 check_icmp: double packet loss thresholds
... to get not instantly critical after 1 packet lost (20%), but after 2.
2023-01-16 12:58:35 +01:00
Alexander A. Klimov c6dd6a092c ITL: add check_linux_netdev 2023-01-16 11:33:23 +01:00
Julian Brost 83dba2f93b
Merge pull request #7921 from Icinga/feature/-fno-limit-debug-info-6395
CLang: compile with -fno-limit-debug-info
2023-01-12 17:10:39 +01:00
Julian Brost 9590c176e3
Merge pull request #9491 from Icinga/9488
Fix compile error on Solaris 11.4
2023-01-12 14:22:52 +01:00
Julian Brost a134837af4
Merge pull request #9610 from Icinga/8609
ITL: mongodb: support --ssl-ca-cert-file
2023-01-12 14:13:37 +01:00
Julian Brost 0294c174a4
Merge pull request #9594 from Icinga/8834
ConfigObjectUtility::GetObjectConfigPath(): just return paths of existing objects
2023-01-09 13:49:58 +01:00
Alexander A. Klimov e1bb085b0f ConfigObjectUtility::DeleteObjectHelper(): only delete _api files
to restore the behavior before the previous commit. Otherwise we'd delete all
API object's child objects' files including applied child object rules in /etc.
2023-01-05 18:05:31 +01:00
Julian Brost dd51997c73
Merge pull request #9624 from Icinga/9618
Make compilable on Boost v1.81
2023-01-05 15:32:22 +01:00
Alexander A. Klimov 99c2d69dc8 Handle boost::beast::http::basic_fields#operator[]() signature change (v1.81)
Use always working std::string(x), not broken x.to_string().
(x is a return value.)
2023-01-05 11:18:20 +01:00
Alexander A. Klimov 5bcbc96e22 Handle boost::beast::http::basic_fields#set() signature change (v1.81)
Make String convertible to boost::beast::string_view (always working),
not boost::string_view (broken).
2023-01-05 11:18:20 +01:00
Alexander A. Klimov 726db57c6c ITL: vmware: support --no_vm_tools_ok 2022-12-13 18:08:01 +01:00
Alexander A. Klimov 9902f9b88f ITL: vmware: sync updated (i.e. broken) CLI arg 2022-12-13 18:01:52 +01:00
Alexander A. Klimov 324b002c33 ITL: mongodb: support --ssl-ca-cert-file 2022-12-13 17:47:30 +01:00
Julian Brost fbb68dbcd0 Namespace: replace behavior classes with a bool
In essence, namespace behaviors acted as hooks for update operations on
namespaces. Two behaviors were implemented:

- `NamespaceBehavior`: allows the update operation unless it acts on a value
  that itself was explicitly marked as constant.
- `ConstNamespaceBehavior`: initially allows insert operations but marks the
  individual values as const. Additionally provides a `Freeze()` member
  function. After this was called, updates are rejected unless a special
  `overrideFrozen` flag is set explicitly.

This marvel of object-oriented programming can be replaced with a simple bool.
This commit basically replaces `Namespace::m_Behavior` with
`Namespace::m_ConstValues` and inlines the behavior functions where they were
called. While doing so, the code was slightly simplified by assuming that
`m_ConstValues` is true if `m_Frozen` is true. This is similar to what the API
allowed in the old code as you could only freeze a `ConstNamespaceBehavior`.
However, this PR moves the `Freeze()` member function and the related
`m_Freeze` member variable to the `Namespace` class. So now the API allows any
namespace to be frozen. The new code also makes sense with the previously
mentioned simplification: a `Namespace` with `m_ConstValues = false` can be
modified without restrictions until `Freeze()` is called. When this is done, it
becomes read-only.

The changes outside of `namespace.*` just adapt the code to the slightly
changed API.
2022-12-09 09:25:46 +01:00
Alexander Aleksandrovič Klimov 4b754637f7
Merge pull request #9605 from Icinga/no-objectlock-copy
Prevent ObjectLock from being copied
2022-12-08 20:00:23 +01:00
Julian Brost a8cc5dff89 Prevent ObjectLock from being copied
Copying an ObjectLock results in the underlying mutex being unlocked too often.
There's also no good reason for copying a scoped locking class (if at all, it
should be moved).
2022-12-08 15:48:01 +01:00
Alexander Aleksandrovič Klimov ca328627cd
Merge pull request #9537 from Icinga/replace-some-raw-pointer-with-intrusive-ptr
FilterUtility: Replace some nested raw pointers by `unique_ptr<>*`
2022-12-06 13:07:24 +01:00
Alexander Aleksandrovič Klimov b585e20a4c
Merge pull request #9591 from Icinga/circular-refs
icinga2 daemon: w/o --dump-objects just check for circular refs
2022-11-30 21:41:21 +01:00
Julian Brost adf5e6e86e
Merge pull request #9557 from Icinga/ctx
CONTEXT: lazily evaluate frames to only actually assemble when needed
2022-11-30 15:13:53 +01:00
Alexander A. Klimov 83021f8231 CONTEXT: use << everywhere to unify usages 2022-11-30 11:06:51 +01:00
Alexander A. Klimov b82814fb29 CONTEXT: lazily evaluate frames to only actually assemble when needed 2022-11-30 11:06:45 +01:00
Alexander A. Klimov 0b46e0aeab CONTEXT: use l_Frames as stack to reduce modification complexity 2022-11-30 10:56:24 +01:00
Alexander A. Klimov 70df0e298e CONTEXT: reduce malloc()s by replacing linked list with vector 2022-11-30 10:56:24 +01:00
Alexander A. Klimov 7c481742f4 icinga2 daemon: w/o --dump-objects just check for circular refs
and don't malloc() anything.
2022-11-30 10:45:50 +01:00
Alexander A. Klimov e53ec2a50f SerializeInternal(): allow to optionally not malloc() anything
This effectively just checks for circular refs.
2022-11-30 10:45:50 +01:00
Julian Brost f59f361f09
Merge pull request #9508 from Icinga/bugfix/fix-data-race-in-apply-rule
Fix data race in `ApplyRule` class
2022-11-29 14:18:09 +01:00
Alexander A. Klimov 145ee890df Just get paths from existing objects for modification and deletion
instead of computing from scratch if they're in the _api package.

For now this changes literally nothing as paths of existing objects still follow
the scheme of paths of new objects which didn't change. Now Icinga only doesn't expect
existing objects at particular paths. However, with the latter in v2.14+ (agent,
satellite) we can just change the path scheme of new objects in v2.16+ (master)
as we wish. The child nodes will just follow the new scheme of paths of new objects.
2022-11-28 16:39:16 +01:00
Yonas Habteab c1f73fbc1d FilterUtility: Replace some nested raw pointers by our `unique_ptr<X>*` 2022-11-28 14:50:54 +01:00
Yonas Habteab 834709543a ApplyRule: Make `m_HasMatches` atomic
This prevents the `m_HasMatches` property from being altered simultaneously.
This might seem harmless (since this property can only be set to true by any calling thread),
however, from a technical (C++) point of view, this constitutes a data race.
2022-11-28 14:13:58 +01:00
Julian Brost ae32b3cbbd
Merge pull request #9586 from Icinga/9363
icinga2 daemon: write icinga2.debug only if --dump-objects given
2022-11-24 16:03:42 +01:00
Julian Brost 63199057d2
Merge pull request #9584 from Icinga/probot/sync-changelog/master/ea6cbb85afc20e5846eabcd17a93267ec4599aa9
CHANGELOG.md: add v2.13.6
2022-11-24 14:06:16 +01:00
Alexander A. Klimov f71612d8f3 icinga2 object list: warn on possibly outdated config 2022-11-24 10:50:17 +01:00
Alexander Aleksandrovič Klimov f855cfa155
Merge pull request #9593 from theFeu/patch-1
Change apt-get to apt
2022-11-23 14:59:46 +01:00
Alexander A. Klimov 0767c6ef87 icinga2 daemon -C: write icinga2.debug only if --dump-objects given
to save config (re)load time.
2022-11-23 12:54:33 +01:00
Julian Brost dd99a5ace9
Merge pull request #9577 from Icinga/ConfigItem-CommitNewItems
ConfigItem::CommitNewItems(): allow fast search of pending items by type
2022-11-23 12:34:51 +01:00
Feu Mourek 76edd00ec2
Change apt-get to apt 2022-11-23 11:09:36 +01:00