Capture escape sequence (ctrl-c) on MAAS command line tool

Hello!

While following along with some of the installation tutorials, I learned the hard way that interrupting the maas init command leaves things in an inconsistent state and there’s no easy way to return from it (aside from blowing away whatever it left in the database).

It’s not unusual (cue Tom Jones) for CLI programs to capture the escape sequence (ctrl-c) and spit out a message about how “hey, since killing the program right now would cause issues, can you please hit ctrl-c again juuuuust to make sure this is what you want to do?” and require the user to hit the escape sequence again.

Since I think the maas cli is Python, it’s probably just a matter of capturing the SIGINT exception during certain sensitive stateful processes/operations?