From 0ca8edf656077c34c450d5ce6fbd1874ce599e9c Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 14 Nov 2020 12:24:55 +0100 Subject: [PATCH] bundles/apt: move patchday to metadata reactor, make patchday configurable --- bundles/apt/metadata.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bundles/apt/metadata.py b/bundles/apt/metadata.py index d2db8f4..e274cc5 100644 --- a/bundles/apt/metadata.py +++ b/bundles/apt/metadata.py @@ -1,9 +1,4 @@ defaults = { - 'cron': { - 'upgrade-and-reboot': '{minute} 1 * * 5 root /usr/local/sbin/upgrade-and-reboot'.format( - minute=node.magic_number % 30, - ), - }, 'icinga2_api': { 'apt': { 'services': { @@ -14,3 +9,17 @@ defaults = { }, }, } + + +@metadata_reactor +def patchday(metadata): + day = metadata.get('apt/unattended_upgrades/day', 5) + + return { + 'cron': { + 'upgrade-and-reboot': '{minute} 1 * * {day} root /usr/local/sbin/upgrade-and-reboot'.format( + minute=node.magic_number % 30, + day=day, + ), + }, + }