diff options
Diffstat (limited to 'cloudinit/transforms/cc_keys_to_console.py')
-rw-r--r-- | cloudinit/transforms/cc_keys_to_console.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/cloudinit/transforms/cc_keys_to_console.py b/cloudinit/transforms/cc_keys_to_console.py index 73a477c0..2f2a5297 100644 --- a/cloudinit/transforms/cc_keys_to_console.py +++ b/cloudinit/transforms/cc_keys_to_console.py @@ -18,11 +18,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from cloudinit.CloudConfig import per_instance -import cloudinit.util as util -import subprocess +from cloudinit.settings import PER_INSTANCE +from cloudinit import util -frequency = per_instance +frequency = PER_INSTANCE def handle(_name, cfg, _cloud, log, _args): @@ -32,11 +31,10 @@ def handle(_name, cfg, _cloud, log, _args): key_blacklist = util.get_cfg_option_list_or_str(cfg, "ssh_key_console_blacklist", ["ssh-dss"]) try: - confp = open('/dev/console', "wb") cmd.append(','.join(fp_blacklist)) cmd.append(','.join(key_blacklist)) - subprocess.call(cmd, stdout=confp) - confp.close() + (stdout, stderr) = util.subp(cmd) + util.write_file('/dev/console', stdout) except: - log.warn("writing keys to console value") + log.warn("Writing keys to console failed!") raise |