Should snapctl set in apps trigger the configure hook?

Heya all.

I am trying out the new support in 2.27 for using snapctl in snap applications, and I have a question.

Understandably, when you use ‘snapctl set’ inside the configure hook, it does not trigger a configure hook run.

However, when used from an app, it probably should trigger a configure hook run?

FWIW, my use case is that I have a command line app that is used to configure my snap (for better UX than naked snap set, with bash completion, config schema, custom commands and such like), and I have to explicitly trigger configure hook after using it. Am thinking to work around this by having the app manually invoke snap/hooks/configure when needed, but this smells bad to me - there maybe be specific context the configure hook sets up that I miss by running the script manually?

Thoughts welcome.


1 Like


This is becoming a pain.

We are manually invoking the configure hook script in our tooling, but this means we must run our cli tool with sudo, or else the configure hook runs as the wrong user.

I’m not sure there’s a right answer here, which perhaps means we need to make the behavior configurable via a flag. The snapctl tool can be used from within the app both with the intention of inflicting a configuration change elsewhere, and with the intention of communicating that the configuration has already changed. Both cases are painful if you want the opposite one.

Right, I see the challenge.

From my POV, just having some way manually to queue a hook to run after the app has exited would do the trick.

Feels like a similar situation to juju’s hook interactions a bit.

Yeah, it’s just a flag on snapctl at set time which tells whether this is supposed to flow through the configure hook or not.

I’m adding to the backlog. (cc @pstolowski)

Sounds good, will do that soon.

Please ping me before we commit on a particular flag name here. This may end up being used by other commands that have similar needs, so it’s best if we find something workable across the board.

1 Like