Skip to content

Commit

Permalink
Merge pull request #183 from xcp-ng/fix/vtpm
Browse files Browse the repository at this point in the history
vtpm: Fix installation of tpm2-tools package using apt-get
  • Loading branch information
stormi authored Dec 12, 2023
2 parents 50a253c + fdb676e commit 71dcf15
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/vtpm/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ def unix_vm_with_tpm2_tools(started_unix_vm_with_vtpm):

pkg_mgr = vm.detect_package_manager()
if pkg_mgr == PackageManagerEnum.APT_GET:
pkg_mgr = 'apt-get'
# Old versions of apt-get doesn't support the --update option with the
# install command so we have to first update then install
cmd = ['apt-get', 'update', '&&', 'apt-get']
elif pkg_mgr == PackageManagerEnum.RPM:
pkg_mgr = 'yum'
cmd = ['yum']
else:
pytest.fail("Unsupported package manager for this test. Cannot install tpm2-tools")

logging.info("Installing tpm2-tools package using '%s'" % pkg_mgr)
vm.ssh([pkg_mgr, 'install', '-y', 'tpm2-tools'])
logging.info("Installing tpm2-tools package using '%s'" % cmd[0])
vm.ssh(cmd + ['install', '-y', 'tpm2-tools'])

yield vm

0 comments on commit 71dcf15

Please sign in to comment.