When exiting due to unknown node type, list valid node types
authorMartin Schwenke <martin@meltin.net>
Thu, 3 Jul 2014 01:10:12 +0000 (11:10 +1000)
committerMartin Schwenke <martin@meltin.net>
Thu, 3 Jul 2014 01:10:12 +0000 (11:10 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
autocluster

index 147670e..f3f0552 100755 (executable)
@@ -408,8 +408,12 @@ expand_nodes ()
        local count=$((${node_count[$node_type]:-0} + 1))
        node_count[$node_type]=$count
        local fmt
-       fmt=$(call_func node_name_format "$node_type") || \
-           die "Node type \"${node_type}\" not defined!!!"
+       fmt=$(call_func node_name_format "$node_type") || {
+           echo "ERROR: Node type \"${node_type}\" not defined!"
+           echo "Valid node types are:"
+           set | sed -n 's@^node_name_format_\(.*\) ().*@  \1@p'
+           exit 1
+       }
        # printf behaves weirdly if given too many args for format, so
        # "head" handles the case where there is no %d or similar for
        # $count.