[apparmor] GSoC review r35..39

Christian Boltz apparmor at cboltz.de
Sat Aug 10 00:37:42 UTC 2013


Hallo,

the reviews for r35..r39 are attached.

I have no complaints about the revisions with even numbers ;-)


Regards,

Christian Boltz
-- 
Aus der Beschreibung entnehme ich, daß deine Fonts nach Typ 3
konvertiert werden (Finger im Hals) und deine Bilder auf Screen-
Qualität (Fuß zum Finger dazusteck...)     [Ratti in suse-linux]
-------------- next part --------------
------------------------------------------------------------
revno: 35
committer: Kshitij Gupta <kgupta8592 at gmail.com
branch nick: apparmor-profile-tools
timestamp: Wed 2013-08-07 14:43:17 +0530
message:
  certain fixes

=== modified file 'apparmor/aa.py'
--- apparmor/aa.py	2013-08-05 20:23:28 +0000
+++ apparmor/aa.py	2013-08-07 09:13:17 +0000
@@ -1337,7 +1337,7 @@
                         if not os.path.exists(get_profile_filename(exec_target)):
                             ynans = 'y'
                             if exec_mode & str_to_mode('i'):
-                                ynans = UI_YesNo(_('A profile for ') + str(exec_target) + gettext(' doesnot exist.\nDo you want to create one?'), 'n')
+                                ynans = UI_YesNo(_('A profile for ') + str(exec_target) + _(' doesnot exist.\nDo you want to create one?'), 'n')

# this text should use %s instead of two split texts

@@ -1596,6 +1596,7 @@
     #last = None
     #event_type = None
     try:
+        print(filename)

# forgotten debug code?

         log_open = open_file_read(filename)
     except IOError:
         raise AppArmorException('Can not read AppArmor logfile: ' + filename)
                         
@ -3371,7 +3376,9 @@
         if not var.get(list_var, False):
             var[list_var] = set(vlist)
         else:
-            raise AppArmorException('An existing variable redefined')
+            print('Ignoring: New definition for variable for:',list_var,'=', value, 'operation was:',var_operation,'old value=', var[list_var])
+            pass
+            #raise AppArmorException('An existing variable redefined')

# variable redefinition should be an error, not a warning
# (apparmor_parser also errors out IIRC)


vim:ft=diff
-------------- next part --------------
------------------------------------------------------------
revno: 37
committer: Kshitij Gupta <kgupta8592 at gmail.com
branch nick: apparmor-profile-tools
timestamp: Fri 2013-08-09 11:04:32 +0530
message:
  fixed debugglogger


=== modified file 'apparmor/common.py'
--- apparmor/common.py	2013-08-05 13:25:34 +0000
+++ apparmor/common.py	2013-08-09 05:34:32 +0000
@@ -188,3 +189,22 @@
         new_reg =  new_reg + '$'
     return new_reg
 
+class DebugLogger:
+    def __init__(self, module_name=__name__):
+        logging.basicConfig(filename='/var/log/apparmor/logprof.log')
+        self.logger = logging.getLogger(module_name)
+        self.debugging = True
+        if os.getenv('LOGPROF_DEBUG', False):
+            self.debugging = True

# maybe we could make LOGPROF_DEBUG an integer (instead of on/off) to define the log level?
# (0 = none, 1=error, 2=error+info, 3=error+info+debug

+    def error(self, msg):
+        if self.debugging:
+            self.logger.error(msg)
+    def info(self, msg):
+        if self.debugging:
+            self.logger.info(msg)
+    def debug(self, msg):
+        if self.debugging:
+            self.logger.debug(msg)
+    def shutdown(self):
+        logging.shutdown()
+        #logging.shutdown([self.logger])



vim:ft=diff
-------------- next part --------------
------------------------------------------------------------
revno: 39
committer: Kshitij Gupta <kgupta8592 at gmail.com
branch nick: apparmor-profile-tools
timestamp: Sat 2013-08-10 01:17:00 +0530
message:
  working logger


=== modified file 'apparmor/common.py'
--- apparmor/common.py	2013-08-09 11:19:01 +0000
+++ apparmor/common.py	2013-08-09 19:47:00 +0000
@@ -191,16 +191,17 @@
 
 class DebugLogger:
     def __init__(self, module_name=__name__):
-        #logging.basicConfig(filename='/var/log/apparmor/logprof.log')
+        logging.basicConfig(filename='/var/log/apparmor/logprof.log', level=logging.DEBUG, format='%(asctime)s - %(name)s - %(message)s\n')   
         self.logger = logging.getLogger(module_name)
-        self.debugging = True
+        self.debugging = False
         if os.getenv('LOGPROF_DEBUG', False):
             self.debugging = True
     def error(self, msg):
         if self.debugging:
+            logging.error(msg)
             self.logger.error(msg)
     def info(self, msg):
+        logging.info(msg)
         if self.debugging:
             self.logger.info(msg)
     def debug(self, msg):

# hmm, for info, logging.info() is always called, even if debugging is off - intentional?


vim:ft=diff


More information about the AppArmor mailing list