6ea6b80
From 715fcfb5d83faa29f8d221d0e2d800b08261810a Mon Sep 17 00:00:00 2001
6ea6b80
From: Matej Habrnal <mhabrnal@redhat.com>
6ea6b80
Date: Tue, 8 Mar 2016 16:42:31 +0100
6ea6b80
Subject: [PATCH] a-a-install-debuginfo: make tmpdir variable global
6ea6b80
6ea6b80
Function clean_up() has one required parameter tmpdir.
6ea6b80
Without this commit clean_up() function raises an exception because it was
6ea6b80
called without the parameter.
6ea6b80
6ea6b80
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
6ea6b80
---
6ea6b80
 src/plugins/abrt-action-install-debuginfo.in | 16 ++++++++--------
6ea6b80
 1 file changed, 8 insertions(+), 8 deletions(-)
6ea6b80
6ea6b80
diff --git a/src/plugins/abrt-action-install-debuginfo.in b/src/plugins/abrt-action-install-debuginfo.in
6ea6b80
index f70ebcd..7818ffd 100644
6ea6b80
--- a/src/plugins/abrt-action-install-debuginfo.in
6ea6b80
+++ b/src/plugins/abrt-action-install-debuginfo.in
6ea6b80
@@ -20,7 +20,8 @@ import problem
6ea6b80
 RETURN_OK = 0
6ea6b80
 # serious problem, should be logged somewhere
6ea6b80
 RETURN_FAILURE = 2
6ea6b80
-
6ea6b80
+# path to tmp directory has to be global because of clean_up()
6ea6b80
+TMPDIR = None
6ea6b80
 
6ea6b80
 GETTEXT_PROGNAME = "abrt"
6ea6b80
 import locale
6ea6b80
@@ -43,11 +44,11 @@ def init_gettext():
6ea6b80
     gettext.textdomain(GETTEXT_PROGNAME)
6ea6b80
 
6ea6b80
 def sigterm_handler(signum, frame):
6ea6b80
-    clean_up()
6ea6b80
+    clean_up(TMPDIR)
6ea6b80
     exit(RETURN_OK)
6ea6b80
 
6ea6b80
 def sigint_handler(signum, frame):
6ea6b80
-    clean_up()
6ea6b80
+    clean_up(TMPDIR)
6ea6b80
     print("\n{0}".format(_("Exiting on user command")))
6ea6b80
     sys.stdout.flush()
6ea6b80
     # ??! without "sys.", I am getting segv!
6ea6b80
@@ -63,7 +64,6 @@ if __name__ == "__main__":
6ea6b80
     fbuild_ids = "build_ids"
6ea6b80
     cachedirs = []
6ea6b80
     size_mb = 4096
6ea6b80
-    tmpdir = None
6ea6b80
     keeprpms = False
6ea6b80
     noninteractive = False
6ea6b80
     b_ids = []
6ea6b80
@@ -135,7 +135,7 @@ if __name__ == "__main__":
6ea6b80
             except:
6ea6b80
                 pass
6ea6b80
         elif opt == "--tmpdir":
6ea6b80
-            tmpdir = arg
6ea6b80
+            TMPDIR = arg
6ea6b80
         elif opt == "--keeprpms":
6ea6b80
             keeprpms = True
6ea6b80
         # --exact takes precendece over --ids
6ea6b80
@@ -159,11 +159,11 @@ if __name__ == "__main__":
6ea6b80
 
6ea6b80
         if not cachedirs:
6ea6b80
             cachedirs = ["/var/cache/abrt-di"]
6ea6b80
-    if not tmpdir:
6ea6b80
+    if not TMPDIR:
6ea6b80
         # security people prefer temp subdirs in app's private dir, like /var/run/abrt
6ea6b80
         # and we switched to /tmp but Fedora feature tmp-on-tmpfs appeared, hence we must
6ea6b80
         # not use /tmp for potential big data anymore
6ea6b80
-        tmpdir = "@LARGE_DATA_TMP_DIR@/abrt-tmp-debuginfo-%s.%u" % (time.strftime("%Y-%m-%d-%H:%M:%S"), os.getpid())
6ea6b80
+        TMPDIR = "@LARGE_DATA_TMP_DIR@/abrt-tmp-debuginfo-%s.%u" % (time.strftime("%Y-%m-%d-%H:%M:%S"), os.getpid())
6ea6b80
 
6ea6b80
 
6ea6b80
     if missing == None:
6ea6b80
@@ -235,7 +235,7 @@ if __name__ == "__main__":
6ea6b80
             sys.exit(RETURN_FAILURE)
6ea6b80
 
6ea6b80
         # TODO: should we pass keep_rpms=keeprpms to DebugInfoDownload here??
6ea6b80
-        downloader = download_class(cache=cachedirs[0], tmp=tmpdir,
6ea6b80
+        downloader = download_class(cache=cachedirs[0], tmp=TMPDIR,
6ea6b80
                                     noninteractive=noninteractive,
6ea6b80
                                     repo_pattern=repo_pattern)
6ea6b80
         try:
6ea6b80
-- 
6ea6b80
2.5.5
6ea6b80