Handle message about wait locks a bit better

This commit is contained in:
Joshua Boniface 2019-06-27 16:20:30 -04:00
parent 1f4b5a6d65
commit 338af97a7a
1 changed files with 4 additions and 2 deletions

View File

@ -150,9 +150,10 @@ def flush_node(zk_conn, node, wait):
return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node)
if zkhandler.readdata(zk_conn, '/locks/flush_lock') == 'True':
retmsg = 'A lock currently exists; use --wait to wait for it, or try again later.'.format(node)
if not wait:
retmsg = 'A lock currently exists; use --wait to wait for it, or try again later.'.format(node)
return False, retmsg
retmsg = 'A lock currently exists; waiting for it to complete... '
lock_wait = True
else:
retmsg = 'Flushing hypervisor {} of running VMs.'.format(node)
@ -187,9 +188,10 @@ def ready_node(zk_conn, node, wait):
return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node)
if zkhandler.readdata(zk_conn, '/locks/flush_lock') == 'True':
retmsg = 'A lock currently exists; use --wait to wait for it, or try again later.'.format(node)
if not wait:
retmsg = 'A lock currently exists; use --wait to wait for it, or try again later.'.format(node)
return False, retmsg
retmsg = 'A lock currently exists; waiting for it to complete... '
lock_wait = True
else:
retmsg = 'Restoring hypervisor {} to active service.'.format(node)