bootstrap-vz/common/tasks/host.py
Anders Ingemann 663b868b41 Fix #107. Rename before and after task properties
`before' becomes `successors' and `after' becomes `predecessors'
2013-11-22 09:03:47 +01:00

20 lines
610 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
predecessors = [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:
log_check_call(['/usr/bin/dpkg-query', '-s', package])
except CalledProcessError:
msg = "The package ``{0}\'\' is not installed".format(package)
raise TaskError(msg)