to use new Description class
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
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 499f434..0a1d06d 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -641,16 +641,16 @@ def myStoragePoolEventRefreshCallback(conn, pool, opaque):
##########################################################################
# Node device events
##########################################################################
-def nodeDeviceEventToString(event):
- nodeDeviceEventStrings = ( "Created",
- "Deleted",
- )
- return nodeDeviceEventStrings[event]
+DEVICE_EVENTS = Description(
+ ("Created", ()),
+ ("Deleted", ()),
+)
+
def myNodeDeviceEventLifecycleCallback(conn, dev, event, detail, opaque):
- print("myNodeDeviceEventLifecycleCallback: Node device %s %s %d" %
(dev.name(),
-
nodeDeviceEventToString(event),
- detail))
+ print("myNodeDeviceEventLifecycleCallback: Node device %s %s %s" % (
+ dev.name(), DEVICE_EVENTS[event], DEVICE_EVENTS[event][detail]))
+
def myNodeDeviceEventUpdateCallback(conn, dev, opaque):
print("myNodeDeviceEventUpdateCallback: Node device %s" % dev.name())
--
2.11.0