From c9a04e79f8f3a1a6ef6b9ea62a6aa93ffde55e21 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 17 Jun 2020 18:11:57 +0800 Subject: [PATCH] teuthology/provision: drop six.ensure_str() Signed-off-by: Kefu Chai --- teuthology/provision/cloud/test/test_cloud_util.py | 2 +- teuthology/provision/cloud/util.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/teuthology/provision/cloud/test/test_cloud_util.py b/teuthology/provision/cloud/test/test_cloud_util.py index 8cae3c9dc0..2f6035a7ce 100644 --- a/teuthology/provision/cloud/test/test_cloud_util.py +++ b/teuthology/provision/cloud/test/test_cloud_util.py @@ -21,7 +21,7 @@ def test_get_user_ssh_pubkey(path, exists): with patch('teuthology.provision.cloud.util.open', mock_open(), create=True) as m_open: util.get_user_ssh_pubkey(path) if exists: - m_open.assert_called_once_with(path, 'rb') + m_open.assert_called_once_with(path) @mark.parametrize( diff --git a/teuthology/provision/cloud/util.py b/teuthology/provision/cloud/util.py index c8170a87d4..a6f137e941 100644 --- a/teuthology/provision/cloud/util.py +++ b/teuthology/provision/cloud/util.py @@ -4,16 +4,14 @@ import dateutil.parser import json import os -from six import ensure_str - from teuthology.util.flock import FileLock def get_user_ssh_pubkey(path='~/.ssh/id_rsa.pub'): full_path = os.path.expanduser(path) if not os.path.exists(full_path): return - with open(full_path, 'rb') as f: - return ensure_str(f.read()).strip() + with open(full_path) as f: + return f.read().strip() def combine_dicts(list_of_dicts, func): -- 2.39.5