snapctl seem to cache values even if snap is removed and then installed again

Bug #1636934 reported by Ondrej Kubik on 2016-10-26
38
This bug affects 6 people
Affects Status Importance Assigned to Milestone
snapd
Medium
Paweł Stołowski

Bug Description

preconditions:
$ snap install <snap>
$ snap set <snap> KEY1="VALUE"
$ snap set <snap> KEY2="VALUE"
$ snap remove <snap>
$ snap install <snap>
$ snap set <snap> KEY1="VALUE"

expected result:
when calling last $ snap set, configure hook associated to this "snap set" I'd expect snapctl only to return value for KEY1

actual result:
snapctl return values for both, KEY1 and KEY2

Are we cleaning snapctl cache when we remove snap?

tested on Ubuntu 16.04 classing
snapd version:
snap 2.16ubuntu3
snapd 2.16ubuntu3
series 16
ubuntu 16.04

Kyle Fazzari (kyrofa) wrote :

Indeed, even after `snap remove` is completed, the snap's configuration settings are still held in /var/lib/snapd/state.json. They should probably be purged, or if this behavior is desired, add a --purge option to `snap remove`.

Changed in snapd (Ubuntu):
status: New → Confirmed
Gustavo Niemeyer (niemeyer) wrote :

We should just clear config up from the state when the last revision from the snap is going away.

That needs to be done in a careful way to take undoing into account.

Eventually we should actually migrate to a model where configuration is keyed by (snap, revision) instead of simply (snap), so that reverts work properly. But that's a separate issue besides the need to clear configuration up on removals.

Michael Vogt (mvo) on 2017-01-27
Changed in snapd (Ubuntu):
importance: Undecided → Medium
Kyle Fazzari (kyrofa) on 2017-02-08
affects: snapd (Ubuntu) → snapd
Manik Taneja (manik) wrote :

This affects me as well. In the previous iteration of the snap, I manually/explicitly changed the port numbers on which it should be working. After removal, and re-installation, those values are being used by the hooks to re-provision the snap, even though its a fresh install.

Changed in snapd:
assignee: nobody → Paweł Stołowski (stolowski)
status: Confirmed → In Progress
Changed in snapd:
status: In Progress → Fix Committed
Kyle Fazzari (kyrofa) wrote :

According to the changelog, it seems this was released in v2.24.

Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers