Some minor tweaks to fix stuff
This commit is contained in:
parent
dacce87175
commit
f2ec143544
5
pvc.py
5
pvc.py
|
@ -467,6 +467,11 @@ def search(dom_name, dom_uuid, long_output):
|
|||
dom_name = pvcf.searchClusterByUUID(zk, dom_uuid)
|
||||
|
||||
information = pvcf.getInformationFromXML(zk, dom_uuid, long_output)
|
||||
|
||||
if information == None:
|
||||
click.echo('Could not find a domain matching that name or UUID.')
|
||||
return
|
||||
|
||||
click.echo(information)
|
||||
pvcf.stopZKConnection(zk)
|
||||
|
||||
|
|
12
pvcf.py
12
pvcf.py
|
@ -67,10 +67,14 @@ def stopZKConnection(zk):
|
|||
#
|
||||
def getInformationFromXML(zk, uuid, long_output):
|
||||
# Obtain the contents of the XML from Zookeeper
|
||||
xml = zk.get('/domains/%s/xml' % uuid)[0].decode('ascii')
|
||||
dstate = zk.get('/domains/%s/state' % uuid)[0].decode('ascii')
|
||||
dhypervisor = zk.get('/domains/%s/hypervisor' % uuid)[0].decode('ascii')
|
||||
dlasthypervisor = zk.get('/domains/%s/lasthypervisor' % uuid)[0].decode('ascii')
|
||||
try:
|
||||
xml = zk.get('/domains/%s/xml' % uuid)[0].decode('ascii')
|
||||
dstate = zk.get('/domains/%s/state' % uuid)[0].decode('ascii')
|
||||
dhypervisor = zk.get('/domains/%s/hypervisor' % uuid)[0].decode('ascii')
|
||||
dlasthypervisor = zk.get('/domains/%s/lasthypervisor' % uuid)[0].decode('ascii')
|
||||
except:
|
||||
return None
|
||||
|
||||
if dlasthypervisor == '':
|
||||
dlasthypervisor = 'N/A'
|
||||
|
||||
|
|
Loading…
Reference in New Issue