Skip to content

Commit

Permalink
Adjust qvm.template_installed to use qvm-check
Browse files Browse the repository at this point in the history
Use qvm-check --template to check if the template exists. This covers
the case of in-place upgraded templates, in addition to those installed
with qvm-template directly.

Fixes QubesOS/qubes-issues#9818
  • Loading branch information
marmarek committed Mar 2, 2025
1 parent 8112f14 commit 251fe86
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions _states/ext_state_qvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,10 @@ def template_installed(name, fromrepo=None, pool=None, **kwargs):
Install into given storage pool. Will not move already installed template.
"""
ret = {'name': name, 'result': False, 'changes': {}, 'comment': ''}
info = __salt__['qvm.template_info'](name)
if info:
status = __salt__['qvm.check'](name, flags=['template'])
if status.passed():
ret['result'] = True
ret['comment'] = 'Template {} version {} already installed'.format(
info['name'], info['version'])
ret['comment'] = 'Template {} already installed'.format(name)
return ret
if __opts__['test']:
ret['result'] = None
Expand Down

0 comments on commit 251fe86

Please sign in to comment.