[PATCH libvirt-python v2 20/22] event-test.py: Convert SECRET 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 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/examples/event-test.py b/examples/event-test.py
index 0a1d06d..5e3b884 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -658,16 +658,16 @@ def myNodeDeviceEventUpdateCallback(conn, dev, opaque):
 ##########################################################################
 # Secret events
 ##########################################################################
-def secretEventToString(event):
-    secretEventStrings = ( "Defined",
-                           "Undefined",
-    )
-    return secretEventStrings[event]
+SECRET_EVENTS = Description(
+    ("Defined", ()),
+    ("Undefined", ()),
+)
+
 
 def mySecretEventLifecycleCallback(conn, secret, event, detail, opaque):
-    print("mySecretEventLifecycleCallback: Secret %s %s %d" % (secret.UUIDString(),
-                                                               secretEventToString(event),
-                                                               detail))
+    print("mySecretEventLifecycleCallback: Secret %s %s %s" % (
+        secret.UUIDString(), SECRET_EVENTS[event], SECRET_EVENTS[event][detail]))
+
 
 def mySecretEventValueChanged(conn, secret, opaque):
     print("mySecretEventValueChanged: Secret %s" % secret.UUIDString())
-- 
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