Merge "Use utils.exit rather than print+sys.exit"
This commit is contained in:
@@ -697,8 +697,6 @@ def main():
|
|||||||
try:
|
try:
|
||||||
OpenStackImagesShell().main(map(encodeutils.safe_decode, sys.argv[1:]))
|
OpenStackImagesShell().main(map(encodeutils.safe_decode, sys.argv[1:]))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('... terminating glance client', file=sys.stderr)
|
utils.exit('... terminating glance client')
|
||||||
sys.exit(1)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(utils.exception_to_str(e), file=sys.stderr)
|
utils.exit(utils.exception_to_str(e))
|
||||||
sys.exit(1)
|
|
||||||
|
@@ -18,7 +18,6 @@ from __future__ import print_function
|
|||||||
import copy
|
import copy
|
||||||
import functools
|
import functools
|
||||||
import six
|
import six
|
||||||
import sys
|
|
||||||
|
|
||||||
from oslo.utils import encodeutils
|
from oslo.utils import encodeutils
|
||||||
from oslo.utils import strutils
|
from oslo.utils import strutils
|
||||||
@@ -356,15 +355,15 @@ def do_image_delete(gc, args):
|
|||||||
def do_member_list(gc, args):
|
def do_member_list(gc, args):
|
||||||
"""Describe sharing permissions by image or tenant."""
|
"""Describe sharing permissions by image or tenant."""
|
||||||
if args.image_id and args.tenant_id:
|
if args.image_id and args.tenant_id:
|
||||||
print('Unable to filter members by both --image-id and --tenant-id.')
|
utils.exit('Unable to filter members by both --image-id and'
|
||||||
sys.exit(1)
|
' --tenant-id.')
|
||||||
elif args.image_id:
|
elif args.image_id:
|
||||||
kwargs = {'image': args.image_id}
|
kwargs = {'image': args.image_id}
|
||||||
elif args.tenant_id:
|
elif args.tenant_id:
|
||||||
kwargs = {'member': args.tenant_id}
|
kwargs = {'member': args.tenant_id}
|
||||||
else:
|
else:
|
||||||
print('Unable to list all members. Specify --image-id or --tenant-id')
|
utils.exit('Unable to list all members. Specify --image-id or'
|
||||||
sys.exit(1)
|
' --tenant-id')
|
||||||
|
|
||||||
members = gc.image_members.list(**kwargs)
|
members = gc.image_members.list(**kwargs)
|
||||||
columns = ['Image ID', 'Member ID', 'Can Share']
|
columns = ['Image ID', 'Member ID', 'Can Share']
|
||||||
|
Reference in New Issue
Block a user