summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-03-12 11:33:57 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-03-12 11:33:57 +0000
commitff473bab72a3a42ceee228b739577a153a3840de (patch)
tree1821f9a20665523ee5f33316498fd11999ad37c8
parent0ad170ce2d5ea81c4aceab16aca27d7f2f3c6e8d (diff)
downloadmorph-ff473bab72a3a42ceee228b739577a153a3840de.tar.gz
Give a useful error when attempting to build a cluster morph
Previously this resulted in a confusing traceback. This is a quick fix. I'd rather insert the error in the buildcommand module instead, but that code assumes the source being built is a system in several places before it actually checks the kind. Those would all need to be changed, or the code would need to reworked to call _validate_root_kind() much earlier. The Application.traverse_morphs() method is rather ugly anyway, so I'm happy to add further ugliness to it for the time being.
-rw-r--r--morphlib/app.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 9ceca9a8..409e0a12 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -359,7 +359,10 @@ class Morph(cliapp.Application):
morphology = resolved_morphologies[reference]
visit(reponame, ref, filename, absref, tree, morphology)
- if morphology['kind'] == 'system':
+ if morphology['kind'] == 'cluster':
+ raise cliapp.AppException(
+ "Cannot build a morphology of type 'cluster'.")
+ elif morphology['kind'] == 'system':
queue.extend((s.get('repo') or reponame,
s.get('ref') or ref,
'%s.morph' % s['morph'])