-
Notifications
You must be signed in to change notification settings - Fork 15
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
Patch window not respected #97
Comments
It seems that the "is_patchday.pp" is the only check if patch run should be executed. That is indeed not efficient, because it is only checking weekdays with patchwindow range. I have another module calling this module, where I've implemented a ruby function that checks if, the patch is actually in the patchwindow before executing patching_as_code. |
Thanks @Boxx1483 but is it not the role of process_patch_groups function (functions/process_patch_groups.pp) to setup schedule based on hours set in your patch group schedule? "Currently, schedules can only be used to stop a resource from being applied; they cannot cause a resource to be applied when it otherwise wouldn't be, and they cannot accurately specify a time when a resource should run." Can it be the reason why I am having this issue? Do I need to play with repeat value? |
You are right, that seems to be the right function. As said I've implemented a ruby function, in a module that calls patching_as_code class. That function checks the actual hour window. Code is pasted below.
This is quite a hack, I'm not sure how this would fit into patching_as_code. |
Seems here #88 |
Describe the Bug
Hi all,
I am struggling to understand why my patch window is not respected when using patching_as_code module.
For example I have a node with 2 patch schedules assigned:
Extract of fact patching_as_code_config on that machine:
I want this node to be patched between 9h and 12h on Wednesday and Fridays but patching happened very early this Wednesday (last_patch_run => "2024-07-17 01:04")
This is fact patching_as_code:
In the apt history.log:
Date and time are correct on the machine:
Offset detection seems correct too:
Why was patching done on Wednesday but around 00:28 and not during the patch schedule window I set:
?
Expected Behavior
Patches are installed between 9h and 12h on Wednesdays, Fridays
Steps to Reproduce
Set a patch schedule between 9h and 12h
Environment
The text was updated successfully, but these errors were encountered: