From 9bcd860c3284abdda64c1f83372332cfa48abde3 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 23 Oct 2009 11:57:29 +0200 Subject: [PATCH] [molecule] add iso_remaster execution_strategy spec file plugin --- molecule/specs/__init__.py | 51 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/molecule/specs/__init__.py b/molecule/specs/__init__.py index 34a4a20..c1f35fa 100644 --- a/molecule/specs/__init__.py +++ b/molecule/specs/__init__.py @@ -16,7 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import os + import molecule.utils class GenericSpecFunctions: @@ -60,7 +60,7 @@ class GenericSpecFunctions: try: x = str(x) return x - except (UnicodeDecodeError,UnicodeEncodeError,): + except (UnicodeDecodeError, UnicodeEncodeError,): return '' def valid_path_string(self, x): @@ -212,7 +212,54 @@ class LivecdSpec(GenericSpec): } +class RemasterSpec(GenericSpec): + @staticmethod + def execution_strategy(): + return "iso_remaster" + + def vital_parameters(self): + return [ + "source_iso", + "destination_iso_directory", + ] + + def parser_data_path(self): + return { + 'prechroot': { + 'cb': self.valid_exec_first_list_item, + 've': self.ve_string_splitter, + }, + 'source_iso': { + 'cb': self.valid_path_string, + 've': self.ve_string_stripper, + }, + 'outer_chroot_script': { + 'cb': self.valid_exec, + 've': self.ve_string_stripper, + }, + 'inner_chroot_script': { + 'cb': self.valid_path_string, + 've': self.ve_string_stripper, + }, + 'extra_mkisofs_parameters': { + 'cb': self.always_valid, + 've': self.ve_string_splitter, + 'mod': self.ve_string_splitter, + }, + 'pre_iso_script': { + 'cb': self.valid_exec, + 've': self.ve_string_stripper, + }, + 'destination_iso_directory': { + 'cb': self.valid_dir, + 've': self.ve_string_stripper, + }, + 'destination_iso_image_name': { + 'cb': self.valid_ascii, + 've': self.ve_string_stripper, + }, + } # FIXME: this will need to be pluggable (and plugin factory is required) SPEC_PLUGS = dict((x.execution_strategy(), x,) for x in \