(WIP) Immutable headnodes

This is probably worth looking at now; there's still some work to do, but it's roughly the shape I'm shooting for.
this should be check_call, not cmd - the old headnode.py file had 'from subprocess import check_call as cmd'
it should be possible to override 'check_call()' using monkey_patch so that you can write a unit test for this.