Currernt config hook implementation scales very badly

Oliver Grawert ogra at ubuntu.com
Wed Feb 1 10:31:16 UTC 2017


hi,

after we recently added a config hook [1] to the core snap it is now
possible to disable ssh if you require [2] ...

there is a long standing request to do the same for syslog for systems
running from SD card, which is why i looked into trying to extend the
existing configure script for this, which made me notice some issue...

when you call "snap set core foo=bar", there is no indication at all
for the script which variable changes a value, neither in the shell
environment nor in the argument list.

the only way to get your value is to call snapctl for every existing
variable [3]. since you dont know what specific variable was requested
to change the only way to reliably write it is to write *all* existing
variables ... 

now, if you package something with a more complex config that you want
completely handled via snap config this gets ugly very fast... imagine
something like postfix with can potentially have 100s of config
options. instead of atomically changing a single option you will
regenerate the full config from scratch. this takes a lot longer,
bringing the risk of a completely broken config in case of a power
loss, beyond resulting an an awful config hook script with a large
block of "snapctl get" calls at the top.

can we extend the config hook implementation minimally so a "snap set
core foo=bar" would at least have something like "SNAP_OPTION=foo" in
the environment that the generating script or binary could read to
avoid the unnecessary processing or would that break some design
concept ?

ciao
	oli

[1] http://bazaar.launchpad.net/~snappy-dev/core-snap/trunk/view/head:/
hooks/configure
[2] https://github.com/CanonicalLtd/ubuntu-core-docs/blob/master/en/ref
erence/core-configuration.md
[3] https://github.com/snapcore/snapd/wiki/hooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20170201/1d91bb7c/attachment.sig>


More information about the Snapcraft mailing list