Add --timeout option to cli
Create a --timeout option to allow users to provide a custom timeout for requests from the command line. The timeout functonality already exists in both v1 and v2 client classes. Related to bp glance-client-parity Change-Id: Ic91de5eae2824b37f6aad3adc5fda28b9674250e
This commit is contained in:
parent
2713ca1bdc
commit
b05a9c0200
@ -57,6 +57,10 @@ class OpenStackImagesShell(object):
|
||||
action='store_true',
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--timeout',
|
||||
default=600,
|
||||
help='Number of seconds to wait for a response')
|
||||
|
||||
parser.add_argument('--os-username',
|
||||
default=utils.env('OS_USERNAME'),
|
||||
help='Defaults to env[OS_USERNAME]')
|
||||
@ -269,11 +273,14 @@ class OpenStackImagesShell(object):
|
||||
}
|
||||
endpoint, token = self._authenticate(**kwargs)
|
||||
|
||||
image_service = glanceclient.client.Client(
|
||||
api_version, endpoint, token, insecure=args.insecure)
|
||||
client = glanceclient.client.Client(api_version,
|
||||
endpoint,
|
||||
token,
|
||||
insecure=args.insecure,
|
||||
timeout=args.timeout)
|
||||
|
||||
try:
|
||||
args.func(image_service, args)
|
||||
args.func(client, args)
|
||||
except exc.Unauthorized:
|
||||
raise exc.CommandError("Invalid OpenStack Identity credentials.")
|
||||
except exc.AuthorizationFailure:
|
||||
|
Loading…
x
Reference in New Issue
Block a user