Split up CheckPaths task in puppet plugin

This commit is contained in:
Anders Ingemann 2014-03-06 20:41:11 +01:00
parent c4794ce9f3
commit b692532d90
2 changed files with 12 additions and 3 deletions

View file

@ -8,9 +8,10 @@ def validate_manifest(data, validator, error):
def resolve_tasks(taskset, manifest):
taskset.add(tasks.CheckPaths)
taskset.add(tasks.AddPackages)
if 'assets' in manifest.plugins['puppet']:
taskset.add(tasks.CheckAssetsPath)
taskset.add(tasks.CopyPuppetAssets)
if 'manifest' in manifest.plugins['puppet']:
taskset.add(tasks.CheckManifestPath)
taskset.add(tasks.ApplyPuppetManifest)

View file

@ -5,8 +5,8 @@ from common.tasks import network
import os
class CheckPaths(Task):
description = 'Checking whether manifest and assets paths exist'
class CheckAssetsPath(Task):
description = 'Checking whether the assets path exist'
phase = phases.preparation
@classmethod
@ -20,6 +20,14 @@ class CheckPaths(Task):
msg = 'The assets path {assets} does not point to a directory.'.format(assets=assets)
raise TaskError(msg)
class CheckManifestPath(Task):
description = 'Checking whether the manifest path exist'
phase = phases.preparation
@classmethod
def run(cls, info):
from common.exceptions import TaskError
manifest = info.manifest.plugins['puppet']['manifest']
if not os.path.exists(manifest):
msg = 'The manifest file {manifest} does not exist.'.format(manifest=manifest)