From c2b0cec6e3cfa7b5ebd9762abca9179581d8722e Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Wed, 9 Jul 2014 13:40:12 -0400 Subject: Create message variables for exceptions Instead of inline messages, let's create variables instead, as it's easier to find strings, and mark them for translation. Change-Id: Ibbcfdbc59d12a0cb4af50f73043d3ff7f3c76f99 --- openstackclient/compute/v2/keypair.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'openstackclient/compute/v2/keypair.py') diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py index 972443a4..6aedbfee 100644 --- a/openstackclient/compute/v2/keypair.py +++ b/openstackclient/compute/v2/keypair.py @@ -57,8 +57,9 @@ class CreateKeypair(show.ShowOne): with open(os.path.expanduser(parsed_args.public_key)) as p: public_key = p.read() except IOError as e: - raise exceptions.CommandError( - "Key file %s not found: %s" % (parsed_args.public_key, e)) + msg = "Key file %s not found: %s" + raise exceptions.CommandError(msg + % (parsed_args.public_key, e)) keypair = compute_client.keypairs.create( parsed_args.name, -- cgit v1.2.1