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

Philipp Hahn posted 22 patches 6 years, 2 months ago
[libvirt] [PATCH libvirt-python v2 21/22] event-test.py: Convert CONNECTION events
Posted by Philipp Hahn 6 years, 2 months ago
to use new Description class

Signed-off-by: Philipp Hahn <hahn@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list