Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add invert mode for holiday.rb #6

Closed
wants to merge 2 commits into from

Conversation

cruelsmith
Copy link
Contributor

Will return every day of the year that are not holidays:

  • Added options to adjust the time of these days.
  • Added options to skip spefic week days.

Replaced fixed half day for chrismas and new year with the option to add additional holidays that should be respected int he output.

Needed since icinga2 has issues with excludes

Will return every day of the year that are not holidays:
* Added options to adjust the time of these days.
* Added options to skip spefic week days.

Replaced fixed half day for chrismas and new year with the option to add
additional holidays that should be respected int he output.

Needed since icinga2 has issues with excludes
Icinga/icinga2#8741 (comment)
@cruelsmith cruelsmith added the enhancement New feature or request label May 31, 2023
@cruelsmith cruelsmith self-assigned this May 31, 2023
@fbrehm
Copy link
Member

fbrehm commented Aug 7, 2023

Hi @cruelsmith ,

which version of Ruby did you use for testing? I have tested tho following Ruby versions:

  • 2.7.6p219
  • 2.7.8p225
  • 3.0.2p107

With all those ruby versions there it not possible to use the options '--invert' and '--date-range':
frank.brehm@jumphost ~/Develop/github-dpx/monitoring-checks (add_inverted_get_holidays) > /opt/puppetlabs/puppet/bin/ruby get_holidays.rb --invert 'XXXX' 2024 Traceback (most recent call last): get_holidays.rb:102:in

': undefined method -' for nil:NilClass (NoMethodError) 1 frank.brehm@jumphost ~/Develop/github-dpx/monitoring-checks (add_inverted_get_holidays) > /opt/puppetlabs/puppet/bin/ruby get_holidays.rb --date-range 'XXXX' 2024 Traceback (most recent call last): get_holidays.rb:102:in ': undefined method -' for nil:NilClass (NoMethodError) 1 frank.brehm@jumphost ~/Develop/github-dpx/monitoring-checks (add_inverted_get_holidays) >

Btw., it would be nice to use a working hash bang, e.g. '#!/usr/bin/env ruby'. Otherwise the script would be interpreted by your current shell with the appropriate error messages, if you are calling it directly.

Cheers Frank

@cruelsmith
Copy link
Contributor Author

Closing the PR since it can not solve or workaround the underlying icinga2 issue: Icinga/icinga2#9781
It can only be fixed by upstream since every possible time definition as we would need for this one here is currently broken.

@cruelsmith cruelsmith closed this May 30, 2024
@cruelsmith cruelsmith deleted the add_inverted_get_holidays branch May 30, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants