mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 23:36:29 +00:00
21 lines
673 B
Python
21 lines
673 B
Python
from base import Task
|
|
from common import phases
|
|
from common.exceptions import TaskError
|
|
import packages
|
|
|
|
|
|
class CheckPackages(Task):
|
|
description = 'Checking installed host packages'
|
|
phase = phases.preparation
|
|
after = [packages.HostPackages, packages.ImagePackages]
|
|
|
|
def run(self, info):
|
|
from common.tools import log_check_call
|
|
from subprocess import CalledProcessError
|
|
for package in info.host_packages:
|
|
try:
|
|
# Use "dpkg-query -W -f='${Status} ${Version}\n' package" instead
|
|
log_check_call(['/usr/bin/dpkg', '--status', package])
|
|
except CalledProcessError:
|
|
msg = "The package ``{0}\'\' is not installed".format(package)
|
|
raise TaskError(msg)
|