As an orthogonal side-note I will comment that one other way to solve this in a more generically useful way would be to implement some support for providing config items to the snap at install time such that you could do something like:
snap install $SNAP_NAME -- key=val
and it’s as if you did snap set $SNAP_NAME key=val
before installing the snap. Then you could implement this kind of debugging with snap install $SNAP_NAME -- disablesvcs=true
and the install hook can get the value of that with snapctl get disablesvcs
and if that’s true then just disable all services and move on.
That does have the disadvantage of needing cooperation from the snap’s install hook so even with this you would still have problems with snaps you don’t control if they don’t implement support for that in the install hook.