← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~brian-murray/apport/grub-hookutils into lp:apport

 

Brian Murray has proposed merging lp:~brian-murray/apport/grub-hookutils into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)

For more details, see:
https://code.launchpad.net/~brian-murray/apport/grub-hookutils/+merge/106906

Lots of package installation failures (friendly-recovery, linux, grub2, memtest86+, ...) are due to conifguration errors in /etc/default/grub.  In the dpkg log files we only get a hint as to what is wrong in /etc/default/grub and it would be better if we could collect this file so we can help the reporter sort it out.

I've moved the code for collecting and filtering /etc/default/grub from grub's apport package hook to the generic hookutils.
-- 
https://code.launchpad.net/~brian-murray/apport/grub-hookutils/+merge/106906
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/grub-hookutils into lp:apport.
=== modified file 'apport/hookutils.py'
--- apport/hookutils.py	2012-04-30 17:44:19 +0000
+++ apport/hookutils.py	2012-05-22 22:38:21 +0000
@@ -862,3 +862,17 @@
         return None
 
     return session_start_time <= report_time
+
+
+def attach_default_grub(report, key=None):
+    '''attach /etc/default/grub after filtering out password lines'''
+    path = '/etc/default/grub'
+    if not key:
+        key = path_to_key(path)
+
+    if os.path.exists(path):
+        with open(path, 'r') as f:
+            filtered = [l if not l.startswith('password')
+                        else '### PASSWORD LINE REMOVED ###'
+                        for l in f.readlines()]
+            report[key] = ''.join(filtered)