summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/config/cc_ssh.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/cloudinit/config/cc_ssh.py b/cloudinit/config/cc_ssh.py
index cd0174da..7fb13333 100644
--- a/cloudinit/config/cc_ssh.py
+++ b/cloudinit/config/cc_ssh.py
@@ -96,12 +96,11 @@ def handle(_name, cfg, cloud, log, _args):
# TODO(harlowja): Is this guard needed?
with util.SeLinuxGuard("/etc/ssh", recursive=True):
try:
- out, err = util.subp(cmd, capture=True, rcs=[0, 1],
- env=lang_c)
- sys.stdout.write(util.encode_text(out))
+ out, err = util.subp(cmd, capture=True, env=lang_c)
+ sys.stdout.write(util.decode_binary(out))
except util.ProcessExecutionError as e:
err = util.decode_binary(e.stderr).lower()
- if err.lower().startswith("unknown key"):
+ if e.exit_code == 1 and err.lower().startswith("unknown key"):
log.debug("unknown key type %s" % keytype)
else:
util.logexc(log, "Failed generating key type %s to "