Merge change 4227 into donut

* changes:
  nexctl: Refactor so Nexus can be tested from scripts easily.