71 Commits

Author SHA1 Message Date
Julian Brost
a740b1d66c LegacyTimePeriod::ScriptFunc: fix DST edge-cases
This change fixes two problems:
* The internal functions used by ScriptFunc more or less expect to operate on
  full days, but ScriptFunc may have called them with some random timestamp
  during the day. This is fixed by always using midnight of the day as
  reference time.
* Previously, the code advanced a timestamp to the next day by adding 24 hours.
  On days with DST changes, this could either still be on the same day (a day
  may have 25 hours) or skip an entire day (a day may have 23 hours). This is
  fixed by using a struct tm to advance the time to the next day.
2021-11-17 13:09:10 +01:00
Julian Brost
4273f30157 LegacyTimePeriod: Prevent modification of input parameters
Many functions of LegacyTimePeriod take a tm pointer as an input parameter and
then pass it to mktime() which actually modifies it. This causes problems if
tm_isdst was intentionally set to -1 (to automatically detect whether DST is
active at some time) and then a function is called that implicitly sets
tm_isdst and then the values of tm are modified in a way that crosses a DST
change. This resulted in 1 hour offsets with ScheduledDowntimes on days with
DST changes.
2021-07-22 15:17:06 +02:00
Alexander A. Klimov
28f708bb7c LegacyTimePeriod: support specifying seconds 2019-08-22 18:50:37 +02:00
Michael Friedrich
88e5d8c47a TimePeriod: Fully support and test "day -X" notation
Previously no tests would have detected if this really worked or not.
2019-07-09 16:21:07 +02:00
Michael Friedrich
0dc87668d6 Fix parsing of "day -X (last day of month)" in TimePeriod class 2019-07-09 16:16:43 +02:00
Michael Friedrich
7665143afa Tests: Rewrite TimePeriod tests using Boost::DateTime
fixes #7257
2019-07-09 15:34:07 +02:00
Alexander A. Klimov
ffd736f56f LegacyTimePeriod::ProcessTimeRangeRaw(): support ranges across midnight
refs #5261
2019-06-06 13:11:34 +02:00
Michael Friedrich
804c00ece5
Merge pull request #6999 from Icinga/bugfix/compiler-warnings
Suppress or fix compiler warnings
2019-03-18 08:44:30 +01:00
Alexander A. Klimov
bf92e32496 Suppress or fix compiler warnings 2019-03-08 14:07:29 +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
David Lublink
a02b7ac155 * BugFix : Wrong operator on stride variable causing incorrect behaviour ( #6749 ) 2018-11-01 18:51:42 -04:00
Michael Friedrich
acd0ad681b
Merge pull request #6704 from efuss/fix/scheduleddowntime1
Put newly configured already running ScheduledDowntime immediately in effect
2018-10-19 12:29:51 +02:00
Edgar Fuß
9c1e9f4264
Put running downtimes in effect
If Icinga2 was restarted with a newly configured downtime that should
be in effect at the time of restart, the should-be-running segment of
it was not put into effect.

Add new LegacyTimePeriod::FindRunningSegment() and
ScheduledDowntime::FindRunningSegment() functions, call the latter in
ScheduledDowntime::CreateNextDowntime() before trying the old
ScheduledDowntime::FindNextSegment().
2018-10-18 18:42:21 +02:00
Michael Friedrich
dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Gunnar Beutner
1a8692d972 Implement support for namespaces 2018-08-13 13:44:31 +02:00
Gunnar Beutner
d9c0b6f806 Refactor REGISTER_SCRIPTFUNCTION_* macros 2018-08-13 13:44:31 +02:00
Gunnar Beutner
94e6be1a65 Remove unused includes 2018-01-22 09:52:29 +01:00
Gunnar Beutner
c2fb9fe226 Use initializer lists for arrays and dictionaries 2018-01-16 12:27:44 +01:00
Michael Insel
158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Jean Flach
2636e6a77a Whitespace fix
What does this change?
* Remove use of spaces for formatting
These could be found by using `grep -r -l -P '^\t+ +[^*]'
* Removal of training whitespaces
* A few lines longer than 120 chars
2017-12-20 14:53:52 +01:00
Gunnar Beutner
1ad83886ac Replace a few more NULLs with nullptr 2017-12-14 15:37:20 +01:00
Gunnar Beutner
325e4a2fb9 Use nullptr instead of <Type>::Ptr() 2017-11-30 17:47:09 +01:00
Gunnar Beutner
5d45c74be3 Improve function metadata by adding arguments
fixes #5087
2017-03-27 14:43:19 +02: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
288413f046 Replace BOOST_FOREACH with range-based for loops
fixes #12538
2016-08-25 06:46:17 +02:00
Gunnar Beutner
43a4acd5a2 Remove deprecated functions
fixes #12507
2016-08-23 15:01:40 +02:00
Gunnar Beutner
e09fb88cae Make sure functions are registered with the correct prefix
refs #12393
2016-08-10 16:33:17 +02:00
Gunnar Beutner
dc06209e4a Move internal script functions into the 'Internal' namespace
fixes #12338
2016-08-10 06:55:44 +02:00
Gunnar Beutner
ed27130402 Fix: "day -X" time specifications are parsed incorrectly
fixes #11147
2016-05-11 09:23:55 +02:00
Adam James
e04b70856b Fix parsing of YYYY-MM-DD in LegacyTimePeriod::ParseTimeSpec
fixes #11132

Signed-off-by: Jean Flach <jean-marcel.flach@netways.de>
2016-02-10 16:24:36 +01:00
Gunnar Beutner
599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Jean Flach
f1a1dfb26e Update use of String::Trim()
fixes #9704
2015-08-27 18:06:20 +02:00
Gunnar Beutner
a5c5569324 Improve timeperiod validation error messages
fixes #8893
2015-03-29 08:13:11 +02:00
Gunnar Beutner
a6822fd59a Fix validation errors for time ranges which span the DST transition
fixes #8892
2015-03-29 08:05:01 +02:00
Michael Friedrich
2ed78e82a8 Validate configured TimePeriod ranges
Requires re-throwing the hidden exceptions inside the existing
timeperiod code and validating the configured time range
strings then.

fixes #7576
2015-02-13 17:10:58 +01:00
Gunnar Beutner
2f44581f14 Validate timeperiod segments
fixes #8309
2015-01-29 14:14:56 +01:00
Michael Friedrich
78bfd0204c Update copyright year 2015-01-22 12:00:23 +01:00
Gunnar Beutner
363f23b1d8 Rename ScriptFunction to Function
fixes #8258
2015-01-21 08:48:38 +01:00
Gunnar Beutner
407f88e185 Fix incorrect week day calculation in LegacyTimePeriod::ParseTimeSpec
fixes #6943
2014-12-20 22:04:24 +01:00
Gunnar Beutner
97168378e8 Rename _DEBUG to I2_DEBUG
fixes #7767
2014-12-19 12:19:28 +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
2d5e9514a5 Refactor logging code 2014-10-19 17:52:17 +02:00
Gunnar Beutner
b18f57a745 Remove logger_fwd.hpp 2014-10-19 14:50:39 +02:00
Michael Friedrich
3ecec31af3 Change log message identifier for libicinga.
Refs #6346
2014-05-28 14:42:00 +02:00
Gunnar Beutner
632026cd9f Rename C++ header files.
Fixes #6291
2014-05-25 16:27:14 +02:00
Gunnar Beutner
6a8db4035d Fix another couple of compiler warnings.
Refs #5823
2014-05-11 08:36:51 +02:00
Gunnar Beutner
ad42367999 Refactor name helper classes a bit.
Refs #5925
2014-04-06 08:15:07 +02:00
Michael Friedrich
ce737ff2f3 Change copyright header (again).
Fixes #5424
2014-03-19 11:42:47 +01:00
Michael Friedrich
555d72150a Update copyright header.
Fixes #5424
2014-01-09 00:32:11 +01:00
Gunnar Beutner
41ded2858c Implement scheduled downtimes.
Fixes #3584
2013-12-06 13:45:18 +01:00