From: Kyr Shatskyy Date: Fri, 13 Dec 2019 00:54:37 +0000 (+0100) Subject: orchestra/connection: cast 'key' to bytes for base64.decodestring X-Git-Tag: 1.1.0~177^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0943179d35403446b5896b88f79dc761346048d1;p=teuthology.git orchestra/connection: cast 'key' to bytes for base64.decodestring Because base64.decodestring accepts bytes, the key variable should be converted from string obj. Signed-off-by: Kyr Shatskyy --- diff --git a/teuthology/orchestra/connection.py b/teuthology/orchestra/connection.py index 81f78bbd1..44e939be9 100644 --- a/teuthology/orchestra/connection.py +++ b/teuthology/orchestra/connection.py @@ -30,9 +30,9 @@ def create_key(keytype, key): Create an ssh-rsa or ssh-dss key. """ if keytype == 'ssh-rsa': - return paramiko.rsakey.RSAKey(data=base64.decodestring(key)) + return paramiko.rsakey.RSAKey(data=base64.decodestring(key.encode())) elif keytype == 'ssh-dss': - return paramiko.dsskey.DSSKey(data=base64.decodestring(key)) + return paramiko.dsskey.DSSKey(data=base64.decodestring(key.encode())) else: raise ValueError('keytype must be ssh-rsa or ssh-dss (DSA)')