Skip to contentSkip to conversation

audit-viewer

DISCUSSION Miloslav Trmac 2 participants 4 messages Feb 19, 2009 – Mar 2, 2009 1 message not in the archive Kbuild

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 7 lines · ----- "Dan Gruhn

I have audit-viewer-0.4 and get the following error from "make install"

Byte-compiling python modules...
client.py dialog_base.py event_dialog.py event_source.py filters.py format_versions.py list_properties.py list_tab.py File "/usr/local/share/audit-viewer/list_tab.py", line 558

Quoted 5 lines
    store_data[column + 1] = l.pop(0) if l else ''
                                       ^

SyntaxError: invalid syntax

Is it just me or should I try the 0.3 version?

Please apply the attached patch against the src subdirectory.
Mirek

usr/share/audit-viewer/event_source.py renamed from event_source.py +8 -7
diff -ur av-orig/event_source.py /usr/share/audit-viewer/event_source.py
@@ -15,7 +15,6 @@
 # permission of Red Hat, Inc.
 #
 # Red Hat Author: Miloslav Trmac <[email protected]>
-import collections
 import datetime
 import re
 
@@ -108,7 +107,7 @@
         # This function is time critical, so it is a bit ugly.  "#o" comments
         # contain the "nice" version of some constructs
         parser = self._create_parser()
-        events = collections.defaultdict(Event)
+        events = {}
 
         parser.search_set_stop(auparse.AUSEARCH_STOP_EVENT)
         if len(filters) > 0:
@@ -135,11 +134,13 @@
         while next_event_fn():
             ts = parser_get_timestamp()
             # FIXME: ts.host seems to be valid only until the next event is read
-            e = events[(ts.serial, ts.sec, ts.milli)]
-            # The Event() constructor does not have access to ts.  Most events
-            # have only a single record, so this usually does not overwrite the
-            # ID unnecessarily.
-            e.id = ts
+            event_key = (ts.serial, ts.sec, ts.milli)
+            try:
+                e = events[event_key]
+            except KeyError:
+                e = Event()
+                e.id = ts
+                events[event_key] = e
             if parser_first_record():
                 e_fields = e.fields
                 while 1: #o while True:
usr/share/audit-viewer/filters.py renamed from filters.py +1 -1
diff -ur av-orig/filters.py /usr/share/audit-viewer/filters.py
@@ -18,7 +18,7 @@
 import datetime
 from gettext import gettext as _, ngettext
 import time
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 import auparse
 
usr/share/audit-viewer/list_tab.py renamed from list_tab.py +5 -2
diff -ur av-orig/list_tab.py /usr/share/audit-viewer/list_tab.py
@@ -18,7 +18,7 @@
 import csv
 from gettext import gettext as _
 import time
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 import gobject
 import gtk
@@ -555,7 +555,10 @@
             for (column, title) in enumerate(self.__field_columns):
                 l = event_fields_get(title, None)
                 # "if l" == "if l is not None and len(l) > 0'
-                store_data[column + 1] = l.pop(0) if l else ''
+                if l:
+                    store_data[column + 1] = l.pop(0)
+                else:
+                    store_data[column + 1] = ''
             events.append((sort_key, tuple(store_data)))
         events.sort(key = lambda event: event[0], reverse = self.sort_reverse)
         return events
usr/share/audit-viewer/main_window.py renamed from main_window.py +1 -1
diff -ur av-orig/main_window.py /usr/share/audit-viewer/main_window.py
@@ -19,7 +19,7 @@
 from gettext import gettext as _
 
 import os
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 import gobject
 import gtk
usr/share/audit-viewer/statistic.py renamed from statistic.py +1 -1
diff -ur av-orig/statistic.py /usr/share/audit-viewer/statistic.py
@@ -18,7 +18,7 @@
 import datetime
 from gettext import gettext as _, ngettext
 import time
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 from filters import FieldFilter, TimestampFilter
 import format_versions
usr/share/audit-viewer/tab.py renamed from tab.py +1 -1
diff -ur av-orig/tab.py /usr/share/audit-viewer/tab.py
@@ -17,7 +17,7 @@
 # Red Hat Author: Miloslav Trmac <[email protected]>
 from gettext import gettext as _
 import copy
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 from dialog_base import DialogBase
 from filters import Filter
#2 lore raw
Quoted 10 lines · Miloslav Trmac
Quoted 9 lines · ----- "Dan Gruhn

I have audit-viewer-0.4 and get the following error from "make install"

Byte-compiling python modules...
client.py dialog_base.py event_dialog.py event_source.py filters.py format_versions.py list_properties.py list_tab.py File "/usr/local/share/audit-viewer/list_tab.py", line 558

    store_data[column + 1] = l.pop(0) if l else ''
                                       ^

SyntaxError: invalid syntax

Quoted 3 lines
Quoted 1 line

Is it just me or should I try the 0.3 version?

Please apply the attached patch against the src subdirectory.
Mirek

Mirek,

Thanks for this patch. I applied it and was able to compile.

I'm having problems running audit-viewer and it appears that I am missing some packages like python-gtkextra, PyChart, and sexy-python. I don't have them available on RHEL 5.2 (or 5.3 for that matter) and have been trying to compile them.

I am working on python-gtkextra-1.1.0 and have gtkextra compiled and installed. When I work on the python-gtkextra I get the following:

# make
Making all in gtkextra
make[1]: Entering directory `/data/master/software/audit/audit-viewer/python-gtkextra-1.1.0/gtkextra'
(cd . \
    && /usr/bin/python ./mycodegen.py \
       --register /usr/share/pygtk/2.0/defs/pango-types.defs \
       --register /usr/share/pygtk/2.0/defs/gdk-types.defs \
       --register /usr/share/pygtk/2.0/defs/gtk-types.defs \
       --override gtkextra.override \
       --prefix pygtkextra gtkextra.defs) > gen-gtkextra.c \
   && cp gen-gtkextra.c gtkextra.c \
   && rm -f gen-gtkextra.c
Traceback (most recent call last):
 File "./mycodegen.py", line 16, in ?
   codegen.codegen.main()
TypeError: main() takes exactly 1 argument (0 given)
make[1]: *** [gtkextra.c] Error 1

I'm guessing that the problem is that 1.1.0 requires python 2.5+ like audit-viewer. Does anyone know if this is true?
Has anyone tried to get audit-viewer working on RHEL5.2?
Any pointers? I think I'm stuck at this point.

Dan

#3 lore raw

Dan,

Quoted 4 lines · ----- "Dan Gruhn

I'm having problems running audit-viewer and it appears that I am missing some packages like python-gtkextra, PyChart, and sexy-python. I don't have them available on RHEL 5.2 (or 5.3 for that matter) and have been trying to compile them.

Oh, sorry about that - I completely forgot about the dependencies.

For libsexy, take the Fedora 10 package, remove the dependencies on hunspell-en and enchant.

For python-gtkextra and python-sexy rebuild the packages available in Fedora 10.

pychart is available in EPEL.
Mirek

#4 lore raw

Mirek,

Thanks for this. I was finally able to get back to this project and have been able to compile everything to get audit-viewer running.

I am getting this error when audit viewer starts:

# audit-viewer
Error reading audit events: No such file or directory.

Thinking that perhaps something is pointing to the wrong files, I attempted to use Window/Change event source.. . Then I get this:
Traceback (most recent call last):
File "/usr/local/share/audit-viewer/main_window.py", line 402, in
__menu_change_event_source_activate
self.__show_source_dialog()
File "/usr/local/share/audit-viewer/main_window.py", line 300, in
__show_source_dialog
self.source_dialog = SourceDialog(self.window, self.client)
File "/usr/local/share/audit-viewer/source_dialog.py", line 58, in
__init__
self.__source_log_with_rotated_toggled)
File "/usr/local/share/audit-viewer/util.py", line 49, in connect_and_run
handler()
File "/usr/local/share/audit-viewer/source_dialog.py", line 161, in
__source_log_with_rotated_toggled
self.source_log.set_active_iter(it)
TypeError: iter should be a GtkTreeIter

Perhaps I am don't understand how to use audit-viewer. Is there any tutorial or documentation somewhere that I could read?

Dan

Quoted 17 lines · Miloslav Trmac

Dan,

Quoted 5 lines · ----- "Dan Gruhn

I'm having problems running audit-viewer and it appears that I am missing some packages like python-gtkextra, PyChart, and sexy-python. I don't have them available on RHEL 5.2 (or 5.3 for that matter) and have been trying to compile them.

Oh, sorry about that - I completely forgot about the dependencies.

For libsexy, take the Fedora 10 package, remove the dependencies on hunspell-en and enchant.

For python-gtkextra and python-sexy rebuild the packages available in Fedora 10.

pychart is available in EPEL.
Mirek

Signature · 6 lines
Dan Gruhn
Group W Inc.
8315 Lee Hwy, Suite 303
Fairfax, VA, 22031
PH: (703) 752-5831
FX: (703) 752-5851