From b1c19a21ba5a0684201727e1f18fac6aec796e58 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 25 Dec 2019 19:31:51 -0500 Subject: [PATCH] Move int cast to helper try block --- client-api/api_lib/pvcapi_helper.py | 4 +++- client-api/pvc-api.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client-api/api_lib/pvcapi_helper.py b/client-api/api_lib/pvcapi_helper.py index 45740f41..335737b5 100755 --- a/client-api/api_lib/pvcapi_helper.py +++ b/client-api/api_lib/pvcapi_helper.py @@ -310,7 +310,9 @@ def vm_console(vm, lines=None): Return the current console log for VM. """ # Default to 10 lines of log if not set - if not lines: + try: + lines = int(lines) + except TypeError: lines = 10 zk_conn = pvc_common.startZKConnection(config['coordinators']) diff --git a/client-api/pvc-api.py b/client-api/pvc-api.py index f4e10b93..0a537740 100755 --- a/client-api/pvc-api.py +++ b/client-api/pvc-api.py @@ -1331,7 +1331,7 @@ class API_VM_Console(Resource): """ return api_helper.vm_console( vm, - int(reqargs.get('lines', None)) + reqargs.get('lines', None) ) api.add_resource(API_VM_Console, '/vm//console')