Move int cast to helper try block

This commit is contained in:
Joshua Boniface 2019-12-25 19:31:51 -05:00
parent 1f77b382ef
commit b1c19a21ba
2 changed files with 4 additions and 2 deletions

View File

@ -310,7 +310,9 @@ def vm_console(vm, lines=None):
Return the current console log for VM. Return the current console log for VM.
""" """
# Default to 10 lines of log if not set # Default to 10 lines of log if not set
if not lines: try:
lines = int(lines)
except TypeError:
lines = 10 lines = 10
zk_conn = pvc_common.startZKConnection(config['coordinators']) zk_conn = pvc_common.startZKConnection(config['coordinators'])

View File

@ -1331,7 +1331,7 @@ class API_VM_Console(Resource):
""" """
return api_helper.vm_console( return api_helper.vm_console(
vm, vm,
int(reqargs.get('lines', None)) reqargs.get('lines', None)
) )
api.add_resource(API_VM_Console, '/vm/<vm>/console') api.add_resource(API_VM_Console, '/vm/<vm>/console')