Add try block around cur hypervisor
On initial deploy this doesn't work since the value is empty; just set the value to None in this case.
This commit is contained in:
		
							
								
								
									
										4
									
								
								pvc.py
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								pvc.py
									
									
									
									
									
								
							@@ -372,7 +372,11 @@ def findTargetHypervisor(zk_conn, search_field, dom_uuid):
 | 
			
		||||
def getHypervisors(zk_conn, dom_uuid):
 | 
			
		||||
    valid_hypervisor_list = []
 | 
			
		||||
    full_hypervisor_list = zk_conn.get_children('/nodes')
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        current_hypervisor = zk_conn.get('/domains/{}/hypervisor'.format(dom_uuid))[0].decode('ascii')
 | 
			
		||||
    except:
 | 
			
		||||
        current_hypervisor = None
 | 
			
		||||
 | 
			
		||||
    for hypervisor in full_hypervisor_list:
 | 
			
		||||
        daemon_state = zk_conn.get('/nodes/{}/daemonstate'.format(hypervisor))[0].decode('ascii')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user