summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2016-03-18 11:36:33 -0500
committerSteve Martinelli <stevemar@ca.ibm.com>2016-03-18 17:48:36 +0000
commit21e414d860347b080ba98fc023029caa16d686f4 (patch)
treed289428ab5c06fbf98635e75ed9409dc94a61036
parent3ccc4f7d06234ad901c0090870b4ec7070caec50 (diff)
downloadpython-openstackclient-21e414d860347b080ba98fc023029caa16d686f4.tar.gz
Fix keypair create --public-key
Commit Id702ccaad239b916340bb17014d1ede0a28aaec9 changed the keypair create --public-key to use io.open but incorrectly reads the file in binary mode, which causes JSON serialization to fail. The unit tests mock out io.ioen (the reason for adding it in the first place actually) so any testing for this specific problem would have to be done in functional tests...yet to come. Closes-bug: 1559125 Change-Id: I7a299a542d9df543bff43d3ea1e7907fc8c5f640
-rw-r--r--openstackclient/compute/v2/keypair.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py
index 22d918a4..1db0f942 100644
--- a/openstackclient/compute/v2/keypair.py
+++ b/openstackclient/compute/v2/keypair.py
@@ -48,8 +48,7 @@ class CreateKeypair(command.ShowOne):
public_key = parsed_args.public_key
if public_key:
try:
- with io.open(os.path.expanduser(parsed_args.public_key),
- "rb") as p:
+ with io.open(os.path.expanduser(parsed_args.public_key)) as p:
public_key = p.read()
except IOError as e:
msg = "Key file %s not found: %s"