diff options
author | Dirk Mueller <dirk@dmllr.de> | 2013-08-04 16:12:23 +0200 |
---|---|---|
committer | Dirk Mueller <dirk@dmllr.de> | 2013-08-26 14:25:23 +0200 |
commit | 69fa91b4322395b125b8e50821ad88d0e0d2a313 (patch) | |
tree | d868fd749d8423f40fafab41de32d0d93b4436cf /glanceclient/v1/shell.py | |
parent | b15c57c4a2cd7566072fcf8adb1422cb3e21b1de (diff) | |
download | python-glanceclient-69fa91b4322395b125b8e50821ad88d0e0d2a313.tar.gz |
Fix python 3.x related Hacking warnings
Convert print operator usages to print functions.
Fix one instance of outdated "except x,y:" syntactical construct.
Remove usages of local() in string formatting alongway.
Change-Id: Id0673a9183a6ea6bd9bf3f5c6d8e7c5f114ebf01
Diffstat (limited to 'glanceclient/v1/shell.py')
-rw-r--r-- | glanceclient/v1/shell.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py index 31c507b..d47a1b7 100644 --- a/glanceclient/v1/shell.py +++ b/glanceclient/v1/shell.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +from __future__ import print_function + import argparse import copy import os @@ -344,18 +346,18 @@ def do_image_delete(gc, args): image = utils.find_resource(gc.images, args_image) try: if args.verbose: - print 'Requesting image delete for %s ...' % \ - strutils.safe_encode(args_image), + print('Requesting image delete for %s ...' % + strutils.safe_encode(args_image), end=' ') gc.images.delete(image) if args.verbose: - print '[Done]' + print('[Done]') except exc.HTTPException as e: if args.verbose: - print '[Fail]' - print '%s: Unable to delete image %s' % (e, args_image) + print('[Fail]') + print('%s: Unable to delete image %s' % (e, args_image)) @utils.arg('--image-id', metavar='<IMAGE_ID>', @@ -365,14 +367,14 @@ def do_image_delete(gc, args): def do_member_list(gc, args): """Describe sharing permissions by image or tenant.""" if args.image_id and args.tenant_id: - print 'Unable to filter members by both --image-id and --tenant-id.' + print('Unable to filter members by both --image-id and --tenant-id.') sys.exit(1) elif args.image_id: kwargs = {'image': args.image_id} elif args.tenant_id: kwargs = {'member': args.tenant_id} else: - print 'Unable to list all members. Specify --image-id or --tenant-id' + print('Unable to list all members. Specify --image-id or --tenant-id') sys.exit(1) members = gc.image_members.list(**kwargs) @@ -402,6 +404,6 @@ def do_member_delete(gc, args): if not args.dry_run: gc.image_members.delete(image_id, args.tenant_id) else: - print "Dry run. We would have done the following:" - print ('Remove "%s" from the member list of image ' - '"%s"' % (args.tenant_id, args.image)) + print("Dry run. We would have done the following:") + print('Remove "%s" from the member list of image ' + '"%s"' % (args.tenant_id, args.image)) |