bootstrap-vz/bootstrapvz/plugins/chef/tasks.py
Tiago Ilieve 14682eb96d Moving remaining plugins to bootstrapvz/plugins/
Three of the last developed plugins remained on the old `plugins/`
folder. This probably happened because they didn't existed when the
`documentation` branch were created, so they weren't moved when it was
rebased against `master`.
2014-04-03 19:08:04 -03:00

40 lines
1.1 KiB
Python

from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import apt
import os
class CheckAssetsPath(Task):
description = 'Checking whether the assets path exist'
phase = phases.preparation
@classmethod
def run(cls, info):
from bootstrapvz.common.exceptions import TaskError
assets = info.manifest.plugins['chef']['assets']
if not os.path.exists(assets):
msg = 'The assets directory {assets} does not exist.'.format(assets=assets)
raise TaskError(msg)
if not os.path.isdir(assets):
msg = 'The assets path {assets} does not point to a directory.'.format(assets=assets)
raise TaskError(msg)
class AddPackages(Task):
description = 'Add chef package'
phase = phases.preparation
predecessors = [apt.AddDefaultSources]
@classmethod
def run(cls, info):
info.packages.add('chef')
class CopyChefAssets(Task):
description = 'Copying chef assets'
phase = phases.system_modification
@classmethod
def run(cls, info):
from bootstrapvz.common.tools import copy_tree
copy_tree(info.manifest.plugins['chef']['assets'], os.path.join(info.root, 'etc/chef'))