From 21e414d860347b080ba98fc023029caa16d686f4 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 18 Mar 2016 11:36:33 -0500 Subject: [PATCH] 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 --- openstackclient/compute/v2/keypair.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py index 22d918a4b3..1db0f942c7 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"