2014-04-03 19:08:04 -03:00
|
|
|
from bootstrapvz.base import Task
|
|
|
|
from bootstrapvz.common import phases
|
2014-04-01 00:23:24 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
class CheckAssetsPath(Task):
|
2016-06-04 11:35:59 +02:00
|
|
|
description = 'Checking whether the assets path exist'
|
2016-09-12 00:52:10 +02:00
|
|
|
phase = phases.validation
|
2014-04-01 00:23:24 +00:00
|
|
|
|
2016-06-04 11:35:59 +02:00
|
|
|
@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)
|
2014-04-01 00:23:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AddPackages(Task):
|
2016-06-04 11:35:59 +02:00
|
|
|
description = 'Add chef package'
|
|
|
|
phase = phases.preparation
|
2014-04-01 00:23:24 +00:00
|
|
|
|
2016-06-04 11:35:59 +02:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
|
|
|
info.packages.add('chef')
|
2014-04-01 00:23:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
class CopyChefAssets(Task):
|
2016-06-04 11:35:59 +02:00
|
|
|
description = 'Copying chef assets'
|
|
|
|
phase = phases.system_modification
|
2014-04-01 00:23:24 +00:00
|
|
|
|
2016-06-04 11:35:59 +02:00
|
|
|
@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'))
|