From 757976faf59bc2caad63102c1b17463933c1b7fa Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Fri, 19 Feb 2016 06:51:32 +0100 Subject: [PATCH] Allow disabling particular tasks in the manager Userspace core support is still a bit problematic, so it is not a good idea to offer this type of tasks to users in the manager. I decided to move the task forms to separate files because I wanted to avoid the need to escape strings in Python code. Signed-off-by: Jakub Filak --- src/Makefile.am | 2 ++ src/config/retrace-server.conf | 7 +++++++ src/manager.wsgi | 13 +++++++++++++ src/manager.xhtml | 31 ++----------------------------- src/manager_usrcore_task_form.xhtml | 17 +++++++++++++++++ src/manager_vmcore_task_form.xhtml | 13 +++++++++++++ 6 files changed, 54 insertions(+), 29 deletions(-) create mode 100644 src/manager_usrcore_task_form.xhtml create mode 100644 src/manager_vmcore_task_form.xhtml diff --git a/src/Makefile.am b/src/Makefile.am index dfd3f53..043c416 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,6 +39,8 @@ interface_PYTHON = backtrace.wsgi \ interface_DATA = index.xhtml \ manager.xhtml \ + manager_vmcore_task_form.xhtml \ + manager_usrcore_task_form.xhtml \ managertask.xhtml \ stats.xhtml # interfacedir should probably be $$(pkgdatadir)/retrace diff --git a/src/config/retrace-server.conf b/src/config/retrace-server.conf index 28991a7..8eab59f 100644 --- a/src/config/retrace-server.conf +++ b/src/config/retrace-server.conf @@ -22,6 +22,12 @@ AllowExternalDir = 0 # Allow to create tasks owned by task manager (security risk) AllowTaskManager = 0 +# Allow to create VMCore tasks in the task manager +AllowVMCoreTask = 1 + +# Allow to create Userspace core tasks in the task manager +AllowUsrCoreTask = 1 + # If white list is disabled, anyone can delete tasks TaskManagerAuthDelete = 0 @@ -143,6 +149,7 @@ EmailNotify = 0 # Who sends the e-mail notifications EmailNotifyFrom = retrace@localhost + [archhosts] i386 = x86_64 = diff --git a/src/manager.wsgi b/src/manager.wsgi index 93ead9d..59d1372 100644 --- a/src/manager.wsgi +++ b/src/manager.wsgi @@ -602,6 +602,18 @@ def application(environ, start_response): custom_url = "%s/__custom__" % match.group(1) + vmcore_form = "" + if CONFIG["AllowVMCoreTask"]: + with open("/usr/share/retrace-server/manager_vmcore_task_form.xhtml") as f: + vmcore_form = f.read(1 << 20) # 1MB + output = output.replace("{vmcore_task_form}", vmcore_form) + + usrcore_form = "" + if CONFIG["AllowUsrCoreTask"]: + with open("/usr/share/retrace-server/manager_usrcore_task_form.xhtml") as f: + usrcore_form = f.read(1 << 20) # 1MB + output = output.replace("{usrcore_task_form}", usrcore_form) + output = output.replace("{title}", title) output = output.replace("{sitename}", sitename) output = output.replace("{available_str}", available_str) @@ -619,4 +631,5 @@ def application(environ, start_response): output = output.replace("{running}", "\n ".join(running)) output = output.replace("{finished}", "\n ".join(finished)) + return response(start_response, "200 OK", output, [("Content-Type", "text/html")]) diff --git a/src/manager.xhtml b/src/manager.xhtml index 041f994..5c3f231 100644 --- a/src/manager.xhtml +++ b/src/manager.xhtml @@ -182,35 +182,8 @@ -

vmcore

-
-
- Kernel version (e.g. 2.6.32-287.el6.x86_64, empty to autodetect): - Be more verbose in case of error -
-
- Custom core location: - - -
Any URL that wget can download or a local path (file:///foo/bar or just /foo/bar)
-
-
-

coredump

-
-
-

All of these three fields override contents of package, executable and os_release files contained in the coredump archive. If you're uploading you have just the bare (compressed) coredump, you must specify these.

- Be more verbose in case of error
- Package (e.g. coreutils-8.22-11.el7):
- Executable (e.g. /usr/bin/sleep):
- OS Release (e.g. Red Hat Enterprise Linux Workstation release 7.0 (Maipo)): -
-
- Custom core location: - - -
Any URL that wget can download or a local path (file:///foo/bar or just /foo/bar)
-
-
+{vmcore_task_form} +{usrcore_task_form}
diff --git a/src/manager_usrcore_task_form.xhtml b/src/manager_usrcore_task_form.xhtml new file mode 100644 index 0000000..c210600 --- /dev/null +++ b/src/manager_usrcore_task_form.xhtml @@ -0,0 +1,17 @@ +

userspace core

+
+
+

All of these three fields override contents of package, executable and os_release files contained in the coredump archive. If you're uploading you have just the bare (compressed) coredump, you must specify these.

+ Be more verbose in case of error
+ Package (e.g. coreutils-8.22-11.el7):
+ Executable (e.g. /usr/bin/sleep):
+ OS Release (e.g. Red Hat Enterprise Linux Workstation release 7.0 (Maipo)): +
+
+ Custom core location: + + +
Any URL that wget can download or a local path (file:///foo/bar or just /foo/bar)
+
+
+ diff --git a/src/manager_vmcore_task_form.xhtml b/src/manager_vmcore_task_form.xhtml new file mode 100644 index 0000000..2307b3b --- /dev/null +++ b/src/manager_vmcore_task_form.xhtml @@ -0,0 +1,13 @@ +

vmcore

+
+
+ Kernel version (e.g. 2.6.32-287.el6.x86_64, empty to autodetect): + Be more verbose in case of error +
+
+ Custom core location: + + +
Any URL that wget can download or a local path (file:///foo/bar or just /foo/bar)
+
+
-- 2.7.1