Skip to content
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

Don't enable apt-daily services, just the timers #7299

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
# Ensure daemon-reload has happened before starting/enabling
- meta: flush_handlers

- name: Ensure apt-daily and apt-daily-upgrade services are unmasked, started and enabled.
- name: Ensure apt-daily and apt-daily-upgrade services are unmasked
systemd:
name: "{{ item }}"
state: started
enabled: yes
# We disable the service unit and enable the timer
enabled: no
masked: no
with_items:
- 'apt-daily'
Expand All @@ -33,10 +33,9 @@
- apt
- unattended-upgrades

- name: Ensure apt-daily and apt-daily-upgrade timers are started, and enabled.
- name: Ensure apt-daily and apt-daily-upgrade timers are enabled.
systemd:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- 'apt-daily.timer'
Expand Down
30 changes: 22 additions & 8 deletions molecule/testinfra/common/test_automatic_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,39 @@ def test_unattended_upgrades_functional(host):


@pytest.mark.parametrize(
"service",
"timer",
[
"apt-daily",
"apt-daily.timer",
"apt-daily-upgrade",
"apt-daily-upgrade.timer",
],
)
def test_apt_daily_services_and_timers_enabled(host, service):
def test_apt_daily_timers_enabled(host, timer):
"""
Ensure the services and timers used for unattended upgrades are enabled
in Ubuntu 20.04 Focal.
Ensure the timers used for unattended upgrades are enabled
"""
with host.sudo():
# The services are started only when the upgrades are being performed.
s = host.service(service)
s = host.service(timer)
assert s.is_enabled


@pytest.mark.parametrize(
"service",
[
"apt-daily.service",
"apt-daily-upgrade.service",
],
)
def test_apt_daily_services_disabled(host, service):
"""
Ensure the corresponding services are disabled
"""
with host.sudo():
print(host.run("systemctl list-units").stdout)
print(host.run("systemctl list-timers").stdout)
s = host.service(service)
assert not s.is_enabled


def test_apt_daily_timer_schedule(host):
"""
Timer for running apt-daily, i.e. 'apt-get update', should be OFFSET_UPDATE hrs
Expand Down
3 changes: 3 additions & 0 deletions securedrop/debian/securedrop-config.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ case "$1" in
# And disable Ubuntu Pro's ua-timer and esm-cache (#6773)
systemctl is-enabled ua-timer.timer && systemctl disable ua-timer.timer
systemctl mask esm-cache
# Disable the apt-daily services but not the timers (#7298)
systemctl is-enabled apt-daily.service && systemctl disable apt-daily.service
systemctl is-enabled apt-daily-upgrade.service && systemctl disable apt-daily-upgrade.service
# Migrate the ssh group to sdssh
securedrop-migrate-ssh-group.py

Expand Down
Loading