Patch window not respected
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- linux, ubuntu
- Domain
- devops
Research direction
The payload names no source files or tests; begin at the patching_as_code module's patch-schedule evaluation and reproduce the Wednesday 09:00–12:00 case on Ubuntu 20.04. Compare the reported schedule, UTC offset, patching_as_code facts, and apt history, and consider the issue done when execution stays within the configured window and the behavior is covered by a regression check.
Written by the indexing model from the issue text.
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)
- Dominant language
- Puppet
- Stars
- 10
- Forks
- 18
- Avg merge
- 6h 10m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from voxpupuli/puppet-patching_as_code
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
When the patching process fails, the "post patching command" will fail to run due to a dependancy. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 42/100
All issues in voxpupuli/puppet-patching_as_code
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
danielmiessler/LifeOS#2215 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
repo:raw-data
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
hotosm/raw-data-api#316 · 1 comment ·
-
agentic-workflows cascade-suspected
Difficulty 2/5 1-3 hours Newbie friendliness 68/100