From 82af038bb035008f4fb8928944710abedbf7694c Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Sat, 15 Oct 2016 20:28:19 -0700 Subject: [PATCH] properly format error messages for volume resizing The error messages are tuples and not substituting variables. Before: $ openstack volume set vol1 --size 1 Failed to set volume size: (u'New size must be greater than %s GB', 2) $ openstack volume set vol1 --size 1 Failed to set volume size: (u'Volume is in %s state, it must be available before size can be extended', u'error') After: $ openstack volume set vol2 --size 3 Failed to set volume size: New size must be greater than 4 GB $ openstack volume set vol2 --size 3 Failed to set volume size: Volume is in error state, it must be available before size can be extended Change-Id: Ide6e644b1c6d1c11a9dc2f3f53c1a1837380b8d5 --- openstackclient/volume/v2/volume.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index e74051145b..cb409711b5 100644 --- a/openstackclient/volume/v2/volume.py +++ b/openstackclient/volume/v2/volume.py @@ -484,10 +484,11 @@ class SetVolume(command.Command): try: if volume.status != 'available': msg = (_("Volume is in %s state, it must be available " - "before size can be extended"), volume.status) + "before size can be extended") % volume.status) raise exceptions.CommandError(msg) if parsed_args.size <= volume.size: - msg = _("New size must be greater than %s GB"), volume.size + msg = (_("New size must be greater than %s GB") + % volume.size) raise exceptions.CommandError(msg) volume_client.volumes.extend(volume.id, parsed_args.size) except Exception as e: