diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-08-16 14:07:55 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-08-16 14:08:08 +0000 |
commit | 9c281e003d3f6f048f065879f5504803f1ec85b3 (patch) | |
tree | 784091108e3d0e0558703607f31200cff70a9f3f /morphlib/morphloader.py | |
parent | f4b7013c4705dd74624efd0e3d6523c8e1938735 (diff) | |
download | morph-9c281e003d3f6f048f065879f5504803f1ec85b3.tar.gz |
Add initial code to support clusters in morphloader
Although clusters morphologies are still loaded using
the old code, `checkout` in the new branch-and-merge
plugin tries to load and validate the morphology using
morphloader.
Diffstat (limited to 'morphlib/morphloader.py')
-rw-r--r-- | morphlib/morphloader.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py index 9b00ded5..70f46064 100644 --- a/morphlib/morphloader.py +++ b/morphlib/morphloader.py @@ -109,6 +109,10 @@ class MorphologyLoader(object): 'name', 'arch', ], + 'cluster': [ + 'name', + 'systems', + ], } _static_defaults = { @@ -144,6 +148,7 @@ class MorphologyLoader(object): 'configuration-extensions': [], 'disk-size': '1G', }, + 'cluster': {}, } def parse_morphology_text(self, text, whence): @@ -217,8 +222,10 @@ class MorphologyLoader(object): # The rest of the validation is dependent on the kind. + # FIXME: move validation of clusters from morph2 to + # here, and use morphload to load the morphology kind = morph['kind'] - if kind not in ('system', 'stratum', 'chunk'): + if kind not in ('system', 'stratum', 'chunk', 'cluster'): raise UnknownKindError(morph['kind'], morph.filename) required = ['kind'] + self._required_fields[kind] @@ -230,9 +237,10 @@ class MorphologyLoader(object): self._validate_system(morph) elif kind == 'stratum': self._validate_stratum(morph) - else: - assert kind == 'chunk' + elif kind == 'chunk': self._validate_chunk(morph) + else: + assert kind == 'cluster' def _validate_system(self, morph): # All stratum names should be unique within a system. @@ -322,9 +330,10 @@ class MorphologyLoader(object): self._set_system_defaults(morphology) elif kind == 'stratum': self._set_stratum_defaults(morphology) - else: - assert kind == 'chunk' + elif kind == 'chunk': self._set_chunk_defaults(morphology) + else: + assert kind == 'cluster' def _set_system_defaults(self, morph): pass |