Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/298'
Browse files Browse the repository at this point in the history
* origin/pr/298:
  Cleaner messages on attempting to remove a Template currently in use
  • Loading branch information
marmarek committed Jul 18, 2024
2 parents c8636cb + 73ff499 commit 55ebbbe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion qubesadmin/tools/qvm_template_postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,22 @@ def import_template_config(args, conf_path, vm):
def pre_remove(args):
'''Handle pre-removal tasks'''
app = args.app
app.log.name = "qvm-template-postprocess"
try:
tpl = app.domains[args.name]
except KeyError:
parser.error('No Qube with this name exists')
dependant_vms = False
for appvm in tpl.appvms:
parser.error('Qube {} uses this template'.format(appvm.name))
dependant_vms = True
app.log.error(
'ERROR! Qube "{}" uses this template'.format(appvm.name))
if dependant_vms:
app.log.warning(
'WARNING! Do not use dnf to uninstall templates!')
app.log.info('Info: Use qvm-template(1) or ' \
'Qubes Template Manager GUI to uninstall templates\n')
sys.exit(1)

tpl.installed_by_rpm = False
del app.domains[args.name]
Expand Down

0 comments on commit 55ebbbe

Please sign in to comment.