summaryrefslogtreecommitdiffstats
path: root/events/eventskeygen.py
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2016-08-01 17:16:50 +0530
committerAravinda VK <avishwan@redhat.com>2016-08-09 00:24:32 -0700
commitf5fbf46d82e4ea5325e89459c5ad9f753f1ca66b (patch)
treea5ea957e4fe015831b67358fa5b82852b15df746 /events/eventskeygen.py
parent720b63c24b07ee64e1338db28de602b9abbef0a1 (diff)
eventsapi: Python library for gf_event
Python library to emit Events from Geo-replication or any other Python apps running in storage nodes. Add $LIBEXEC/glusterfs/events to Python path to use gf_event gf_event(event_type, **kwargs) For example, sys.path.insert(1, "LIBEXECDIR/glusterfs") from events.gf_event import gf_event from events import eventtypes gf_event(eventtypes.GEOREP_FAULTY, volname="gv1", slaveuser="root", slavehost="node1", slavevol="gv2") Errors will be logged in $LOGDIR/glusterfs/events.log BUG: 1362144 Change-Id: I2af2bd77f9961975e4387006b9e99e4543e12b57 Signed-off-by: Aravinda VK <avishwan@redhat.com> Reviewed-on: http://review.gluster.org/15063 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'events/eventskeygen.py')
-rw-r--r--events/eventskeygen.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
index bccb91a3a64..7357d8e84a3 100644
--- a/events/eventskeygen.py
+++ b/events/eventskeygen.py
@@ -78,4 +78,8 @@ if gen_header_type == "PY_HEADER":
f.write("all_events = [\n")
for ev in keys:
f.write(' "{0}",\n'.format(ev))
- f.write("]\n")
+
+ f.write("]\n\n")
+
+ for idx, ev in enumerate(keys):
+ f.write("{0} = {1}\n".format(ev.replace("EVENT_", ""), idx))