From b05a9c0200f68426b162a23ca6e6612381a1d1b7 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Wed, 4 Jul 2012 14:32:52 -0700 Subject: [PATCH] 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 --- glanceclient/shell.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 065046e..0ae5bd0 100644 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -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: