From ff473bab72a3a42ceee228b739577a153a3840de Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Wed, 12 Mar 2014 11:33:57 +0000 Subject: 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. --- morphlib/app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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']) -- cgit v1.2.1