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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



to use new Description class

Signed-off-by: Philipp Hahn <hahn@xxxxxxxxxxxxx>
---
 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux