Suppressing the output is useless (fucking C function...)
This commit is contained in:
parent
012f341e75
commit
285b4434b7
15
pvcf.py
15
pvcf.py
|
@ -9,8 +9,7 @@ import os, sys, libvirt, uuid
|
|||
# > lookupByUUID
|
||||
# This function is a wrapper for libvirt.lookupByUUID which fixes some problems
|
||||
# 1. Takes a text UUID and handles converting it to bytes
|
||||
# 2. Disables stdout to avoid stupid printouts
|
||||
# 3. Try's it and returns a sensible value if not
|
||||
# 2. Try's it and returns a sensible value if not
|
||||
def lookupByUUID(tuuid):
|
||||
conn = None
|
||||
dom = None
|
||||
|
@ -19,12 +18,6 @@ def lookupByUUID(tuuid):
|
|||
# Convert the text UUID to bytes
|
||||
buuid = uuid.UUID(tuuid).bytes
|
||||
|
||||
# Flush and disable stdout and stderr
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
sys.stdout = open(os.devnull, 'w')
|
||||
sys.stderr = open(os.devnull, 'w')
|
||||
|
||||
# Try
|
||||
try:
|
||||
# Open a libvirt connection
|
||||
|
@ -46,12 +39,6 @@ def lookupByUUID(tuuid):
|
|||
if conn != None:
|
||||
conn.close()
|
||||
|
||||
# Flush and enable stdout and stderr
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
sys.stdout = sys.__stdout__
|
||||
sys.stderr = sys.__stderr__
|
||||
|
||||
# Return the dom object (or None)
|
||||
return dom
|
||||
|
||||
|
|
Loading…
Reference in New Issue