-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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:
patch_schedule => {
friday => {
count_of_week => [
1,
2,
3,
4,
5
],
day_of_week => "Friday",
hours => "09:00 - 12:00",
max_runs => 4,
reboot => "never"
},
wednesday => {
count_of_week => [
1,
2,
3,
4,
5
],
day_of_week => "Wednesday",
hours => "09:00 - 12:00",
max_runs => 4,
reboot => "never"
}
},
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:
{
choco_patches_installed_on_last_high_prio_run => [
],
choco_patches_installed_on_last_run => [
],
days_since_last_high_prio_patch_run => 0,
days_since_last_patch_run => 0,
last_high_prio_patch_run => "",
last_patch_run => "2024-07-17 01:04",
patches_installed_on_last_high_prio_run => [
],
patches_installed_on_last_run => [
"python3.8",
"libpython3.8",
"libpython3.8-stdlib",
"python3.8-minimal",
"libpython3.8-minimal",
"firefox",
"ghostscript-x",
"ghostscript",
"libgs9",
"libgs9-common",
"linux-headers-5.4.0-189",
"linux-headers-5.4.0-189-generic",
"linux-headers-generic",
"linux-libc-dev"
]
}
In the apt history.log:
Start-Date: 2024-07-17 00:28:03
Commandline: /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install python3.8
Upgrade: libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.9, 3.8.10-0ubuntu1~20.04.10), libpython3.8:amd64 (3.8.10-0ubuntu1~20.04.9, 3.8.10-0ubuntu1~20.04.10), python3.8:amd64 (3.8.10-0ubuntu1~20.04.9, 3.8.10-0ubuntu1~20.04.10), python3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.9, 3.8.10-0ubuntu1~20.04.10), libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04.9, 3.8.10-0ubuntu1~20.04.10)
End-Date: 2024-07-17 00:28:07
Start-Date: 2024-07-17 00:33:12
Commandline: /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install firefox
Upgrade: firefox:amd64 (127.0.2+build1-0ubuntu0.20.04.1, 128.0+build2-0ubuntu0.20.04.1)
End-Date: 2024-07-17 00:33:21
Start-Date: 2024-07-17 00:38:23
Commandline: /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install ghostscript-x
Upgrade: libgs9:amd64 (9.50~dfsg-5ubuntu4.12, 9.50~dfsg-5ubuntu4.13), ghostscript:amd64 (9.50~dfsg-5ubuntu4.12, 9.50~dfsg-5ubuntu4.13), ghostscript-x:amd64 (9.50~dfsg-5ubuntu4.12, 9.50~dfsg-5ubuntu4.13), libgs9-common:amd64 (9.50~dfsg-5ubuntu4.12, 9.50~dfsg-5ubuntu4.13)
End-Date: 2024-07-17 00:38:25
Start-Date: 2024-07-17 00:43:28
Commandline: /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install linux-headers-5.4.0-189
Install: linux-headers-5.4.0-189:amd64 (5.4.0-189.209)
End-Date: 2024-07-17 00:43:32
Start-Date: 2024-07-17 00:48:33
Commandline: /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install linux-headers-5.4.0-189-generic
Install: linux-headers-5.4.0-189-generic:amd64 (5.4.0-189.209)
End-Date: 2024-07-17 00:48:35
Start-Date: 2024-07-17 00:53:37
Commandline: /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install linux-headers-generic
Upgrade: linux-headers-generic:amd64 (5.4.0.187.185, 5.4.0.189.187)
End-Date: 2024-07-17 00:53:37
Start-Date: 2024-07-17 00:58:39
Commandline: /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install linux-libc-dev
Upgrade: linux-libc-dev:amd64 (5.4.0-187.207, 5.4.0-189.209)
End-Date: 2024-07-17 00:58:40
*** command from post patching script ***
Start-Date: 2024-07-17 01:04:48
Commandline: /usr/bin/apt-get -y autoremove
Remove: libnatpmp1:amd64 (20150609-7build1), linux-headers-5.4.0-187:amd64 (5.4.0-187.207), libsysmetrics1:amd64 (1.6.1ubuntu0.1), linux-headers-5.4.0-187-generic:amd64 (5.4.0-187.207), libevent-2.1-7:amd64 (2.1.11-stable-1)
End-Date: 2024-07-17 01:04:50
Date and time are correct on the machine:
~# date
Wed 17 Jul 2024 11:26:17 AM CEST
~# timedatectl
Local time: Wed 2024-07-17 11:26:28 CEST
Universal time: Wed 2024-07-17 09:26:28 UTC
RTC time: Wed 2024-07-17 09:26:28
Time zone: Europe/Paris (CEST, +0200)
System clock synchronized: yes
NTP service: n/a
RTC in local TZ: no
Offset detection seems correct too:
~# facter -p patching_as_code_utc_offset
2.0
Why was patching done on Wednesday but around 00:28 and not during the patch schedule window I set:
day_of_week => "Wednesday",
hours => "09:00 - 12:00",
?
Expected Behavior
Patches are installed between 9h and 12h on Wednesdays, Fridays
Steps to Reproduce
Set a patch schedule between 9h and 12h
Environment
- Version 1.1.7
- Platform Ubuntu 20.04 (I have also done the same setup on different OS and different days. I will update this case if it happens with other OS)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working