many: remove snapd.refresh.{timer,service}

We used to have an emergency timer that would run a forced refresh once
a week to ensure that if something is wrong with our refresh schedule
implementation we have a way out.

We don't need this anymore because:
- we have the monthly schedule now so weekly does not fit anymore
- we have repairs for emergencies which are on their own timer
- our internal refresh got quite a bit of testing since we introduced it

This should be cherry-picked back to 2.31 and 2.32.
This commit is contained in:
Michael Vogt
2018-02-26 08:04:04 +01:00
parent 2e69dcefb0
commit 4e2cea3d1a
9 changed files with 11 additions and 55 deletions

View File

@@ -17,7 +17,7 @@ prepare: |
cd /
echo "Install hello-world"
snap install hello-world
systemctl stop snapd.refresh.timer snapd.service snapd.socket
systemctl stop snapd.service snapd.socket
# all of this ls madness can go away when we have remote environment
# variables
echo "Unmount original core snap"
@@ -31,7 +31,7 @@ prepare: |
if [ ! -e $(ls -1 /var/lib/snapd/snaps/ubuntu-core_*.snap | tail -1) ]; then exit 1; fi
echo "Mount modified core snap"
mount $(ls -1 /var/lib/snapd/snaps/ubuntu-core_*.snap | tail -1) $(ls -1d /snap/ubuntu-core/* | grep -v current | tail -1)
systemctl start snapd.refresh.timer snapd.service snapd.socket
systemctl start snapd.service snapd.socket
execute: |
exit 0
cd /
@@ -51,7 +51,7 @@ restore: |
exit 0
echo "Remove hello-world"
snap remove hello-world
systemctl stop snapd.refresh.timer snapd.service snapd.socket
systemctl stop snapd.service snapd.socket
echo "Unmount the modified core snap"
# all of this ls madness can go away when we have remote environment
# variables
@@ -66,4 +66,4 @@ restore: |
udevadm settle
udevadm trigger
udevadm settle
systemctl start snapd.refresh.timer snapd.service snapd.socket
systemctl start snapd.service snapd.socket

View File

@@ -1,11 +0,0 @@
[Unit]
Description=Automatically refresh installed snaps
After=network-online.target snapd.socket
Requires=snapd.socket
ConditionPathExistsGlob=@SNAP_MOUNT_DIR@/*/current
Documentation=man:snap(1)
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'if ! @bindir@/snap refresh --time|grep "schedule:.*managed"; then @bindir@/snap refresh; fi'
Environment=SNAP_REFRESH_FROM_EMERGENCY_TIMER=1

View File

@@ -1,14 +0,0 @@
[Unit]
Description=Timer to automatically refresh installed snaps
[Timer]
# do a weekly refresh using the time to ensure that we can still
# fix any potential errors in the internal timer handling
OnCalendar=weekly
RandomizedDelaySec=6h
AccuracySec=10min
Persistent=true
OnStartupSec=15m
[Install]
WantedBy=timers.target

View File

@@ -4,7 +4,7 @@ post_install() {
echo 'To use snapd start/enable the snapd.socket'
echo
echo 'If you want your apps to be automatically updated'
echo 'from the store start/enable the snapd.refresh.timer'
echo 'from the store start/enable the snapd.service'
echo
echo 'NOTE: Desktop entries show up after logging in again'
echo ' or rebooting after snapd installation'
@@ -15,9 +15,7 @@ post_install() {
_systemctl_do_for_all() {
/usr/bin/systemctl "$@" \
snapd.service \
snapd.socket \
snapd.refresh.timer \
snapd.refresh.service > /dev/null 2>&1
snapd.socket > /dev/null 2>&1
}
_stop_services() {
@@ -46,9 +44,6 @@ post_upgrade() {
if /usr/bin/systemctl -q is-enabled snapd.socket > /dev/null 2>&1; then
/usr/bin/systemctl start snapd.socket > /dev/null 2>&1 || :
fi
if systemctl -q is-enabled snapd.refresh.timer > /dev/null 2>&1; then
systemctl start snapd.refresh.timer > /dev/null 2>&1 || :
fi
}
# vim:set ts=2 sw=2 et:

View File

@@ -50,7 +50,7 @@
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
%global snappy_svcs snapd.service snapd.socket snapd.autoimport.service snapd.refresh.timer snapd.refresh.service
%global snappy_svcs snapd.service snapd.socket snapd.autoimport.service
# Until we have a way to add more extldflags to gobuild macro...
%if 0%{?fedora} >= 26
@@ -601,8 +601,6 @@ popd
%{_unitdir}/snapd.socket
%{_unitdir}/snapd.service
%{_unitdir}/snapd.autoimport.service
%{_unitdir}/snapd.refresh.service
%{_unitdir}/snapd.refresh.timer
%{_unitdir}/var-lib-snapd-snap.mount
%{_datadir}/dbus-1/services/io.snapcraft.Launcher.service
%{_datadir}/polkit-1/actions/io.snapcraft.snapd.policy
@@ -676,9 +674,6 @@ if [ $1 -eq 1 ] ; then
if systemctl -q is-enabled snapd.socket > /dev/null 2>&1 ; then
systemctl start snapd.socket > /dev/null 2>&1 || :
fi
if systemctl -q is-enabled snapd.refresh.timer > /dev/null 2>&1 ; then
systemctl start snapd.refresh.timer > /dev/null 2>&1 || :
fi
fi
%preun

View File

@@ -30,7 +30,7 @@
%global with_test_keys 0
%endif
%define systemd_services_list snapd.refresh.timer snapd.refresh.service snapd.socket snapd.service
%define systemd_services_list snapd.socket snapd.service
Name: snapd
Version: 2.31.1
Release: 0
@@ -288,8 +288,6 @@ fi
%verify(not user group mode) %attr(06755,root,root) %{_libexecdir}/snapd/snap-confine
%{_mandir}/man1/snap-confine.1.gz
%{_mandir}/man5/snap-discard-ns.5.gz
%{_unitdir}/snapd.refresh.service
%{_unitdir}/snapd.refresh.timer
%{_unitdir}/snapd.service
%{_unitdir}/snapd.socket
%{_unitdir}/snap.mount

View File

@@ -17,8 +17,8 @@ case "$1" in
# snapd.system-shutdown.service is not strictly needed on 14.04. Its functionality
# is limited to core devices, we still include it here for the sake of comppleteness
# in comparison to 16.04 setups.
systemctl -f enable snapd.refresh.timer snapd.refresh.service snapd.autoimport.service snapd.socket snapd.service snap.mount.service snapd.system-shutdown.service
systemctl start snapd.refresh.timer snapd.autoimport.service snapd.socket snapd.service snap.mount.service
systemctl -f enable snapd.autoimport.service snapd.socket snapd.service snap.mount.service snapd.system-shutdown.service
systemctl start snapd.autoimport.service snapd.socket snapd.service snap.mount.service
fi
case ":$PATH:" in

View File

@@ -73,13 +73,6 @@ execute: |
fi
snap refresh --time | MATCH 'schedule: managed'
echo "Check that the snapd.refresh.service is disabled as well"
systemctl start snapd.refresh.service
if snap changes | MATCH "Refresh all snaps"; then
echo "snapd.refresh.service did refresh, this should not happen"
exit 1
fi
# make sure we trigger a refresh for hints at least once
systemctl stop snapd.socket snapd.service
jq ".data[\"last-refresh\"] = \"2007-08-22T09:30:44.449455783+01:00\"" /var/lib/snapd/state.json > /var/lib/snapd/state.json.new

View File

@@ -12,6 +12,6 @@ execute: |
systemctl status snapd.service |MATCH active
echo "Ensure timers are working"
for timer in snapd.refresh.timer snapd.snap-repair.timer; do
for timer in snapd.snap-repair.timer; do
systemctl is-active $timer
done