13582 Commits

Author SHA1 Message Date
Julian Brost
3dab46623b Move Types namespace into type.cpp and simplify Type::GetByName()
This commit moves the initialization of the globals.Types namespace to type.cpp
in order to keep a pointer to the Namespace object in Type::m_Namespace and
simplify Type::GetByName() using it.

The dynamic type check is moved into an assertion after freezing the namespace.
2023-01-26 14:26:41 +01:00
Yonas Habteab
5a67ddea76 Don't post-increment stl iterators 2023-01-26 09:10:49 +01:00
Yonas Habteab
8bb0b857d8 ApiListener: Fix memory leak & group a || b && c correctly 2023-01-26 09:10:49 +01:00
Yonas Habteab
95cec9cba2 Don't mark a method as virtual in a final class 2023-01-26 09:10:38 +01:00
Yonas Habteab
7b91b200f5 Use simplified if conditions where applicable 2023-01-26 09:06:20 +01:00
Yonas Habteab
38313434d2 Avoid calling GetDeferredInitializers() repeatedly 2023-01-26 09:05:19 +01:00
Alexander Aleksandrovič Klimov
bb99106926
Merge pull request #7863 from Icinga/bugfix/disallow-receiving-ticket-salt-via-api
Disallow fetching the ticket salt via REST API
2023-01-25 16:39:30 +01:00
Julian Brost
5fea15e090
Merge pull request #7958 from Icinga/bugfix/api-500-404-7956
/v1/actions/*: return 404 if no objects found
2023-01-24 15:08:17 +01:00
Julian Brost
1a158c400f
Merge pull request #9056 from Icinga/Al2Klimov-patch-5
check_logfiles: --winwarncrit is a flag, not a param
2023-01-24 14:01:55 +01:00
Julian Brost
b10c288146
Merge pull request #8005 from Icinga/feature/http-verify-host-7969
check_http: support --verify-host
2023-01-24 13:02:08 +01:00
Alexander Aleksandrovič Klimov
11e37a0bd1
Merge pull request #9424 from Icinga/run-only-a-single-job-per-workflow-at-a-time
Run only a single job per workflow at a time
2023-01-20 20:35:51 +01:00
Johannes Meyer
9f757dd551 Run only a single job per workflow matrix at a time
This limits each run of these workflows to a single
active matrix job. This means, for each PR, merge or
release only five jobs run concurrently.
2023-01-20 15:44:40 +01:00
Julian Brost
d29ff62017
Merge pull request #9636 from Icinga/gha-cancel
GHA: let GitHub cancel redundant jobs
2023-01-20 15:33:24 +01:00
Julian Brost
c3e4098b41
Merge pull request #9635 from Icinga/eol
GHA: drop EOL OSes
2023-01-20 14:19:43 +01:00
Michael Friedrich
4d57de2a1a Hide TicketSalt in /v1/variables 2023-01-20 12:38:18 +01:00
Alexander Aleksandrovič Klimov
e38a907a7e
Merge pull request #9627 from Icinga/namespace-shared-mutex
Namespace: use rwlock and disable read locking after freeze
2023-01-19 22:44:30 +01:00
Julian Brost
24b57f0d3a Namespace: don't acquire shared locks on frozen namespaces
This makes freezing a namespace an irrevocable operation but in return allows
omitting further lock operations. This results in a performance improvement as
reading an atomic bool is faster than acquiring and releasing a shared lock.

ObjectLocks on namespaces remain untouched as these mostly affect write
operations which there should be none of after freezing (if there are some,
they will throw exceptions anyways).
2023-01-19 17:56:44 +01:00
Julian Brost
cc0e2ec181 Use a shared_mutex for read Namespace operations
This allows multiple parallel read operations resulting in a overall speedup on
systems with many cores.
2023-01-19 17:55:29 +01:00
Julian Brost
1c066fc02e Simplify NamespaceValue class hierarchy to one struct without member functions
This commit removes EmbeddedNamespaceValue and ConstEmbeddedNamespaceValue and
reduces NamespaceValue down to a simple struct without inheritance or member
functions. The code from these clases is inlined into the Namespace class. The
class hierarchy determining whether a value is const is moved to an attribute
of NamespaceValue.

This is done in preparation for changes to the locking in the Namespace class.
Currently, it relies on a recursive mutex. In the future, a shared mutex
(read/write lock) should be used instead, which cannot allow recursive locking
(without failing or risk deadlocking on lock upgrades). With this change, all
operations requiring a lock for one operation are within one function, no
recursive locking is not needed any more.
2023-01-19 17:55:11 +01:00
Julian Brost
0f7cfa372a
Merge pull request #9637 from Icinga/Al2Klimov-patch-6
GHA: revert back to ubuntu-latest
2023-01-19 17:38:10 +01:00
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 A. Klimov
1d8cffe9b9 GHA: let GitHub cancel redundant jobs
This will also cancel not yet finished master builds, but that's not too bad.
2023-01-19 10:47:14 +01:00
Alexander A. Klimov
aa0a25caa7 GHA: drop EOL OSes 2023-01-19 10:30:26 +01:00
Julian Brost
0503ca1379 Initialize namespaces without using overrideFrozen
This commit adds a new initialization priority `FreezeNamespaces` that is run
last and moves all calls to `Namespace::Freeze()` there. This allows all other
initialization functions to still update namespaces without the use of the
`overrideFrozen` flag.

It also moves the initialization of `System.Platform*` and `System.Build*` to
an initialize function so that these can also be set without setting
`overrideFrozen`.

This is preparation for a following commit that will make the frozen flag in
namespaces finial, no longer allowing it to be overriden (freezing the
namespace will disable locking, so performing further updates would be unsafe).
2023-01-19 09:53:36 +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
21f548d3c0 Remove no-op InfluxDB URL param
precision=ns is the default.
2023-01-16 12:03:08 +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
d059885d9b Main process: ignore SIGHUP
On OpenBSD rcctl reload icinga2 SIGHUPs all "icinga2" processes,
not just our umbrella. We must handle this.
2023-01-03 18:29:31 +01:00
Alexander A. Klimov
ecca01f4c3 Document Notification#times being not aware of downtimes
i.e. that times.* count from HARD state change, not downtime end.
2023-01-02 12:23:07 +01:00