diff --git a/plugins/puppet/__init__.py b/plugins/puppet/__init__.py index 089a0ca..458b1cd 100644 --- a/plugins/puppet/__init__.py +++ b/plugins/puppet/__init__.py @@ -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) diff --git a/plugins/puppet/tasks.py b/plugins/puppet/tasks.py index 5545bf1..369979e 100644 --- a/plugins/puppet/tasks.py +++ b/plugins/puppet/tasks.py @@ -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)