bootstrap-vz/common/tasks/host.py
Anders Ingemann e1fc5ea972 Use long options wherever possible.
This makes the code a lot easier to understand
2013-08-17 15:00:53 +00:00

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