[libvirt] [PATCH libvirt-python v2 21/22] event-test.py: Convert CONNECTION events

Philipp Hahn hahn at univention.de
Fri Sep 21 13:35:16 UTC 2018


to use new Description class

Signed-off-by: Philipp Hahn <hahn at univention.de>
---
 examples/event-test.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/examples/event-test.py b/examples/event-test.py
index 5e3b884..1e94838 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -677,15 +677,16 @@ def mySecretEventValueChanged(conn, secret, opaque):
 ##########################################################################
 
 run = True
+CONNECTION_EVENTS = Description("Error", "End-of-file", "Keepalive", "Client")
+
 
 def myConnectionCloseCallback(conn, reason, opaque):
-    reasonStrings = (
-        "Error", "End-of-file", "Keepalive", "Client",
-        )
-    print("myConnectionCloseCallback: %s: %s" % (conn.getURI(), reasonStrings[reason]))
+    print("myConnectionCloseCallback: %s: %s" % (
+        conn.getURI(), CONNECTION_EVENTS[reason]))
     global run
     run = False
 
+
 def usage():
     print("usage: %s [-hdl] [uri]" % (os.path.basename(__file__),))
     print("   uri will default to qemu:///system")
-- 
2.11.0




More information about the libvir-list mailing list