Merge "Manage 10periodic and 20auto-upgrades together"

This commit is contained in:
Zuul 2022-02-02 16:27:46 +00:00 committed by Gerrit Code Review
commit 83ae9c4663
4 changed files with 11 additions and 5 deletions

View File

@ -1,2 +0,0 @@
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

View File

@ -56,11 +56,15 @@
src: debian_limits.conf src: debian_limits.conf
dest: /etc/security/limits.d/60-nofile-limit.conf dest: /etc/security/limits.d/60-nofile-limit.conf
# TODO combine 10periodic and 20auto-upgrades # The next two files share a source file. Different packages manage
# each of these and we do not want them to get out of sync with each
# other as that can impact the configuration that apt sees based on
# priority rules. We address this by making the two files have the same
# content.
- name: Install apt-daily 10periodic file for unattended-upgrades - name: Install apt-daily 10periodic file for unattended-upgrades
copy: copy:
mode: 0444 mode: 0444
src: 10periodic src: XYperiodic-updates
dest: /etc/apt/apt.conf.d/10periodic dest: /etc/apt/apt.conf.d/10periodic
owner: root owner: root
group: root group: root
@ -68,7 +72,7 @@
- name: Install 20auto-upgrades file for unattended-upgrades - name: Install 20auto-upgrades file for unattended-upgrades
copy: copy:
mode: 0444 mode: 0444
src: 20auto-upgrades src: XYperiodic-updates
dest: /etc/apt/apt.conf.d/20auto-upgrades dest: /etc/apt/apt.conf.d/20auto-upgrades
owner: root owner: root
group: root group: root

View File

@ -99,8 +99,12 @@ def test_unattended_upgrades(host):
cfg_file = host.file("/etc/apt/apt.conf.d/20auto-upgrades") cfg_file = host.file("/etc/apt/apt.conf.d/20auto-upgrades")
assert cfg_file.exists assert cfg_file.exists
assert cfg_file.contains('^APT::Periodic::Enable "1"')
assert cfg_file.contains('^APT::Periodic::Update-Package-Lists "1"') assert cfg_file.contains('^APT::Periodic::Update-Package-Lists "1"')
assert cfg_file.contains('^APT::Periodic::Download-Upgradeable-Packages "1"')
assert cfg_file.contains('^APT::Periodic::AutocleanInterval "5"')
assert cfg_file.contains('^APT::Periodic::Unattended-Upgrade "1"') assert cfg_file.contains('^APT::Periodic::Unattended-Upgrade "1"')
assert cfg_file.contains('^APT::Periodic::RandomSleep "1800"')
cfg_file = host.file("/etc/apt/apt.conf.d/50unattended-upgrades") cfg_file = host.file("/etc/apt/apt.conf.d/50unattended-upgrades")
assert cfg_file.contains('^Unattended-Upgrade::Mail "root"') assert cfg_file.contains('^Unattended-Upgrade::Mail "root"')