Fix listing bug in node info

Fixes a listing bug during 'node info -l' introduced in previous
commit 4a3780cf as a "cleanup", and makes this a little more
elegant.

References #12
This commit is contained in:
Joshua Boniface 2018-07-19 22:01:31 -04:00
parent 090929fdde
commit 61aef9fd3e
1 changed files with 3 additions and 2 deletions

3
pvc.py
View File

@ -1339,9 +1339,10 @@ def get_vm_list(hypervisor, limit):
exit(1) exit(1)
# Check hypervisor to avoid unneeded ZK calls # Check hypervisor to avoid unneeded ZK calls
vm_hypervisor[vm] = zk_conn.get('/domains/{}/hypervisor'.format(vm))[0].decode('ascii') vm_hypervisor[vm] = zk_conn.get('/domains/{}/hypervisor'.format(vm))[0].decode('ascii')
if hypervisor != None and vm_hypervisor[vm] == hypervisor: if hypervisor == None:
vm_list.append(vm) vm_list.append(vm)
else: else:
if vm_hypervisor[vm] == hypervisor:
vm_list.append(vm) vm_list.append(vm)
# Gather information for printing # Gather information for printing