Fix connecting to minimal qubes as root#8
Conversation
|
PipelineRetry |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
==========================================
+ Coverage 69.04% 70.03% +0.99%
==========================================
Files 1 1
Lines 504 504
==========================================
+ Hits 348 353 +5
+ Misses 156 151 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@bcduggan are you able to add tests for the connection part? If not, I would manage to add some on top of you branch to validate it works without further breakages. |
|
@fepitre Absolutely, I'll add tests as soon as I can. |
ec424fa to
c477162
Compare
|
@fepitre I added tests and a new fixture to create a minimalvm, It looks like there's no minimal template available in the runner. I tried fedora-41-minimal and debian-12-minimal. Is that the source of the test failures in CI? How can a minimal template be added to the CI environment? |
|
Indeed minimal templates are not installed there. The tests are running in a fresh default installation of Qubes OS. |
f98a061 to
b1128bf
Compare
|
Adding the minimal template to the test host worked great. Now a couple of connection tests actually fail. The CLI tests for connecting with qubes.VMRootShell ( It feels like the mgmtvm policy for qubes.VMRootShell in the test environment might not set the |
|
I have a better idea:QubesOS/qubes-core-agent-linux#579 |
b1128bf to
7fa0ffb
Compare
|
Can you rebase the PR to resolve conflicts? |
Remove attempt to explicitly call qubes.VMRootShell RPC for file transfers.
7fa0ffb to
8c8b1dc
Compare
|
black complains: https://gitlab.com/QubesOS/qubes-ansible/-/jobs/10557873859 |
- Add valid choices for `remote_user` connect option - Let Ansible module framework handle invalid choices - Remove `shell` argument from `_qubes` method - Execute shell RPC for given user
- Install debian-12-minimal template on test host - Add minimalvm fixture - Test that... - invalid 'remote_user' value fails - default user is 'user' on vms and minimal vms - 'remote_user' works on vms and minimal vms with 'root' and 'user' - 'become' works on vms - 'become' fails on minimal vms
- Add local ansible.cfg to specify stdout callback - Run plays individually in test_vm_connection and test_minimalvm_connection - Test JSON content instead of stdout - Comment out test for tag presence in test_properties_and_tags_playbook since the status command of the qubes module only reports vm state
8c8b1dc to
bd2d72c
Compare
|
The test fails... I did checked that qubes.VMRootShell service works correctly now even without |
|
Actually, is the test using debian-12-minimal template? Or default template? I think it's the default template, which would explain why it fails (default template in CI don't have relevant update included yet). |
|
I wasn't sure the test should succeed, yet, actually. Sorry, I should have asked.
I have only been able to test on 4.2 so far. I verified that it uses qubes.VMRootShell there before the rebase.
I also verified that the test VM that I haven't been able to locally test the rebased branch since qubesadmin.device_protocol isn't available on 4.2. I'll set up a 4.3 system from a signed weekly build and test there. |
|
The |
|
I see what you mean. Right, They both fail the |
|
CI shows only one failure, |
|
Oh, fantastic. I could swear CI showed two failures after I pushed the rebased (and then re-blacked) branch. Great. Thanks, @marmarek ! |
|
And now it's all green! :) |
|
@fepitre this appears to work now. AFAIR you raised a concern regarding a |
|
Note the |
|
Also calling attention to the test for setting tags on a VM in The tags test looks for applied tags in the Ansible output, but I don't believe the qubesos module's If that functionality doesn't belong in the qubesos module, it might fit better in a qvm_tags_info module, like this qvm_prefs_info module. Documented in QubesOS/qubes-issues#10010 |
I'll manage that point. |
Ansible "become" modules don't allow becoming root on qubes without the
qubes-core-agent-passwordless-rootpackage installed, like minimal qubes, by design. Users should use theremote_userto login as root on minimal qubes. However, this functionality is broken due to a number of issues in the connection module and documentation.This PR...
qubes.VMRootShellpolicy in the READMEremote_useroption (discussion)To login as root on minimal qubes, users must set
remote_user: rooton tasks and plays.Closes QubesOS/qubes-issues#9939
Closes QubesOS/qubes-issues#9934
Closes QubesOS/qubes-issues#9938