Fixed apt_key's add_key stalling indefinitely, and test code leaking into production

HEAD version of apt_key didn't work properly due missing input to "apt-get add -". Additionally bit of test code had improper indent level, causing it to be run in production.