snapd: fix race in TestSanityFailGoesIntoDegradedMode test
Ensure the MockSanityCheck code runs at least *twice* to
avoid a race in the TestSanityFailGoesIntoDegradedMode test:
If we close the channel and this wakes up the "select"
in the test immediately and stops this go-routine, then the
check that the logbuf contains the error will fail.
By running this at least twice we know the error made
it to the log.
cmd: fix snap-device-helper to deal correctly with hooks
Our current snap-device-helper code does not correctly handle
hooks. The input for the snap-device-helper is an "APPANME"
that looks like "snap_$snapname_$appname". There are no "."
allowed in a udev tag. So this appname needs to be translated
back into the correct security tag, like: "snap.$snapname.$appname".
This works most of the time, however it does not for hooks. They
have the form "snap_$snapname_hook_$hookname" and the script
cannot transform them correctly. This PR fixes this in a simple
way.
One open question is what about instances that are called "hook".
Those will now be handled incorrectly.
tests: add new configure hook testcase with network-control
The configure hook with network-control cannot access /dev/null.
This was reported in the forum as https://forum.snapcraft.io/t/9452
and this PR reproduces the issue.