How to unset snap config?

pstolowski
backlog

#1

What’s the best/proper way to unset a snap config?

I’ve been telling people to do it by setting to null, e.g. snap set kube-apiserver runtime-config=null, since that worked for me in the past. I haven’t seen any documentation around it though. Is that the right way to do it?


#2

There is currently no way to remove configuration values, that’s clearly an omission on our side and we will fix it. You can set it to null or empty string, but you cannot get rid of the value.

Having said that, setting it to null exposed a bug: https://bugs.launchpad.net/snapd/+bug/1699768 (I know you are are aware of the bug, just mentioning it for everyone else following the topic) and the proposed fix is here: https://github.com/snapcore/snapd/pull/3541

We will address the problem of removing unwanted config keys separately (details to be decided).


#3

Resurrecting the old topic, just to give quick update on this; adding an ability to unset snap config is currently on our roadmap and per discussion from last sprint, we’re going to add two ways for unsetting:

  • snap unset (e.g. snap unset core http.proxy)
  • snap set k=v k! (k! will unset key, e.g. snap set core proxy.http=foo proxy.https!)

The second syntax will allow setting and unsetting configuration keys in one go, as part of same transaction.