daemon: modify unit tests of TestErrToResponse to test multiple snaps
This modification is needed to test the edge case of having one snap
failing with ErrSnapNotFound and another snap being successful.
It used to return 500 error instead of the more useful 404.
daemon: fix /v2/snaps "Internal Server Error" error when installing unknown snaps
Internal Server Error response was returned when only one of many snaps is
not found. The problem was passing all snap names (including succesful ones)
to errToResponse instead of the unknown snap only.
In the following example only "spamandeggs" is not found, 404 status code is
expected, 500 is returned instead:
curl -sS --unix-socket /run/snapd.socket http://localhost/v2/snaps -X POST \
-d '{"action": "install", "snaps": ["spamandeggs", "hello"]}' -H "Content-Type: application/json" \
| jq
> {
> "type": "error",
> "status-code": 500,
> "status": "Internal Server Error",
> "result": {
> "message": "store.SnapNotFound with 2 snaps"
> }
> }
Fully confined snaps, and docker containers, look very similar. As
moveroot/pivotroot/chroot is changed, and apparmor confinement
applied. Yet confined snaps constantly try to write to .pyc files of
the base snap, whereas docker containers are trying to write .pyc
files inside the child docker containers... and yet both are
denied. Whilst former is undesired, the latter is very confusing.
Introduce a new inline template replacement for pycache deny rules
(such that all existing snippet tests remain intact), and make
docker-support interface suppress pycache deny rules.
* Fix comment typo
---------
Co-authored-by: Michael Vogt <email address hidden>