diff --git a/bootstrapvz/plugins/file_copy/__init__.py b/bootstrapvz/plugins/file_copy/__init__.py index aea8352..475cbb6 100644 --- a/bootstrapvz/plugins/file_copy/__init__.py +++ b/bootstrapvz/plugins/file_copy/__init__.py @@ -3,13 +3,18 @@ import tasks def validate_manifest(data, validator, error): import os.path + schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml')) validator(data, schema_path) + for i, file_entry in enumerate(data['plugins']['file_copy']['files']): + srcfile = file_entry['src'] + if not os.path.isfile(srcfile): + msg = 'The source file %s does not exist.' % srcfile + error(msg, ['plugins', 'file_copy', 'files', i]) + def resolve_tasks(taskset, manifest): - taskset.add(tasks.ValidateSourcePaths) - if ('mkdirs' in manifest.plugins['file_copy']): taskset.add(tasks.MkdirCommand) if ('files' in manifest.plugins['file_copy']): diff --git a/bootstrapvz/plugins/file_copy/tasks.py b/bootstrapvz/plugins/file_copy/tasks.py index 90e1f08..dd3e054 100644 --- a/bootstrapvz/plugins/file_copy/tasks.py +++ b/bootstrapvz/plugins/file_copy/tasks.py @@ -5,20 +5,6 @@ import os import shutil -class ValidateSourcePaths(Task): - description = 'Check whether the files to be copied exist' - phase = phases.preparation - - @classmethod - def run(cls, info): - from bootstrapvz.common.exceptions import TaskError - for file_entry in info.manifest.plugins['file_copy']['files']: - srcfile = file_entry['src'] - if not os.path.isfile(srcfile): - msg = 'The source file %s does not exist.' % srcfile - raise TaskError(msg) - - def modify_path(info, path, entry): from bootstrapvz.common.tools import log_check_call if 'permissions' in entry: