Skip to content

Disentangle reusable template logic from qvm-template CLI#409

Draft
eaon wants to merge 12 commits intoQubesOS:mainfrom
eaon:templates-lib-refactor
Draft

Disentangle reusable template logic from qvm-template CLI#409
eaon wants to merge 12 commits intoQubesOS:mainfrom
eaon:templates-lib-refactor

Conversation

@eaon
Copy link

@eaon eaon commented Jan 21, 2026

This extracts the core template management functionality from qvm_template.py into a new qubesadmin.templates module, separating reusable library code from CLI-specific concerns like argument parsing and terminal output.

These changes primarily move code rather than modify it, meaning the logic should not have changed unless that was required for functionality extraction.

The original code had parser.error() calls scattered throughout, resulting in sys.exit(). Functions now signal errors and progress in Python rather than just in stdout/stderr. In short, qvm-template-gui could avoid parsing/showing the cli tool's output, as with this change it could use the module provide native Qt progress bars etc.

I did cursory testing (both on the cli and with qvm-template-gui) and didn't run into issues. Happy to do more if there's interest in merging this but you want more thorough manual testing. I couldn't find an issue that suggested this should happen.

@eaon
Copy link
Author

eaon commented Jan 21, 2026

I had avoided uploading my key to keyservers but now did it.

Edit: I'll address the lint/test issues in upcoming commits. Converted to draft for now.

@eaon eaon marked this pull request as draft January 21, 2026 23:29
@marmarek
Copy link
Member

marmarek commented Feb 7, 2026

Just to confirm: yes, I'm happy with the overall idea of this PR. But all tests need to pass.

@ben-grande
Copy link
Contributor

ping

@eaon
Copy link
Author

eaon commented Mar 4, 2026

Hiyah, I'm still planning on getting back to this - technical issues and life got in the way. Should have some time later this week/early next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants