[DPE-7908] Separation of storage (take 2)#257
Conversation
|
Thanks for the context. I had happily forgot all these details. |
sinclert-canonical
left a comment
There was a problem hiding this comment.
I reviewed commits 52e4a2c, 8e50a82 and 5dc6357, which I assumed are the ones built on top of PR #256.
They are exactly the same as the ones in the previously approved separation of storage PR, aside from the encapsulation of the required root user switch in a single conditional (which I find highly convenient).
Fantastic investigation 💯
paulomach
left a comment
There was a problem hiding this comment.
Left some questions - otherwise is good given the constraints
5dc6357 to
f40eb2f
Compare
|
Some stuff failing on K8s, looking into it. |
|
After closer inspection, I figured that the failing tests are probably not related to this PR. So I'm merging as-is. |
560a3f6 to
0f5671f
Compare
|
Proposal for self-healing test that was failing here #264 |
|
There are some test failures from the usual suspects. I'm going ahead but I'll keep an eye on these tests for the coming days. |
Issue
(Depends on #256)
I went back and forth over several days about this. There's a series of unfortunate circumstances that make it difficult to find an elegant, simple implementation.
snap_daemon. This user has the home directory set to/nonexistent, and any attempt to trigger it (sudo -u,subprocess.Popen(user=),runuser -u) will trigger a snap confinement error.root. Specifically, [MISC] Add wrappers for backup apps charmed-mysql-snap#104. This usessetprivas recommended in the official Snap documentation and as done for other apps already.rootcan runsetpriv, which means that the wrapped scripts must all run asrootto drop privileges properly.snap_daemon. This includessnap_daemonand let everything else useuserandgroupwould suffice. But this was wrong. The backup methods require creating some temporary directories in writable locations.snap_daemon, except the scripts themselves, which must be run asroot.root. Seemed similar to what I initially tried in [MISC] Remove permissions hack from backups using wrapped apps (VM) #247._execute_commandsin the child subclass. Ugly, but effective. This is what's implemented here.However, I think this might introduce a lot of indirection, some duplicity, and little benefit.
Ultimately, the tension comes because the
userparameter clashes with the need to execute the wrappers asroot. The solution is clear, but the architecture of the code makes it hard to actually implement.Solution
Checklist