diff options
| author | Michal Toman <mtoman@redhat.com> | 2010-11-05 14:24:57 +0100 |
|---|---|---|
| committer | Michal Toman <mtoman@redhat.com> | 2010-11-05 14:24:57 +0100 |
| commit | 14a80afb484c6985fde7182c78e4e5ceb98f02f8 (patch) | |
| tree | 11d917b10623d7bdfbe33d1d2397301cb0a2e2c5 | |
| parent | 233126772dde5ddaada70b517a2bd099ef3b4f79 (diff) | |
add worker
| -rwxr-xr-x | retrace/install.sh | 95 | ||||
| -rw-r--r-- | retrace/interface/retrace.py | 99 |
2 files changed, 0 insertions, 194 deletions
diff --git a/retrace/install.sh b/retrace/install.sh deleted file mode 100755 index 995a0887..00000000 --- a/retrace/install.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -######################################### -# Retrace server test installer # -# Michal Toman <mtoman@redhat.com> # -# # -# Requires: # -# root permissions # -# httpd installed in standard locations # -# mod_wsgi installed # -# xz with working --list installed # -######################################### - -SCRIPTDIR="/usr/share/abrt-retrace" -WORKDIR="/var/spool/abrt-retrace" -OWNER="apache" - -if [ $EUID = "0" ] -then - if [ ! -d $WORKDIR ] - then - if mkdir $WORKDIR - then - echo "Created directory $WORKDIR" - if chown $OWNER $WORKDIR - then - echo "$WORKDIR owner changed to $OWNER" - else - echo "Unable to change $WORKDIR owner to $OWNER" - exit 3 - fi - else - echo "Unable to create directory $WORKDIR" - exit 2 - fi - fi - - if [ ! -d $SCRIPTDIR ] - then - if mkdir $SCRIPTDIR - then - echo "Created directory $SCRIPTDIR" - if chown $OWNER $SCRIPTDIR - then - echo "$SCRIPTDIR owner changed to $OWNER" - else - echo "Unable to change $SCRIPTDIR owner to $OWNER" - exit 5 - fi - else - echo "Unable to create directory $SCRIPTDIR" - exit 4 - fi - fi - - for FILE in ./interface/* - do - if cp -f $FILE $SCRIPTDIR - then - echo "Installed $FILE" - else - echo "Error installing file $FILE" - exit 6 - fi - done - - FILE="./config/retrace.conf" - if [ -f $FILE ] - then - if cp -f $FILE /etc/abrt/retrace.conf - then - echo "Installed $FILE" - else - echo "Error installing $FILE" - exit 7 - fi - fi - - FILE="./config/retrace_httpd.conf" - if [ -f $FILE ] - then - if cp -f $FILE /etc/httpd/conf.d/retrace.conf - then - echo "Installed $FILE" - else - echo "Error installing $FILE" - exit 8 - fi - fi - - service httpd restart -else - echo "You must run $0 as root." - exit 1 -fi
\ No newline at end of file diff --git a/retrace/interface/retrace.py b/retrace/interface/retrace.py deleted file mode 100644 index 2c5fdfe4..00000000 --- a/retrace/interface/retrace.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/python -import os -import re -import ConfigParser -import random -from webob import Request -from subprocess import * - -REQUIRED_FILES = ["architecture", "coredump", "packages", "release"] - -DF_OUTPUT_PARSER = re.compile("^([^ ^\t]*)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+%)[ \t]+(.*)$") -XZ_OUTPUT_PARSER = re.compile("^totals[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+\.[0-9]+)[ \t]+([^ ^\t]+)[ \t]+([0-9]+)[ \t]+([0-9]+)$") -URL_PARSER = re.compile("^/([a-zA-Z0-9]+)/") - -TASKID_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - -CONFIG_FILE = "/etc/abrt/retrace.conf" -CONFIG = { - "TaskIdLength": 64, - "MaxParallelTasks": 2, - "MaxPackedSize": 30, - "MaxUnpackedSize": 600, - "MinStorageLeft": 10240, - "WorkDir": "/var/spool/abrt-retrace", -} - -def read_config(): - parser = ConfigParser.ConfigParser() - parser.read(CONFIG_FILE) - for key in CONFIG.keys(): - vartype = type(CONFIG[key]) - if vartype is int: - get = parser.getint - elif vartype is bool: - get = parser.getbool - elif vartype is float: - get = parser.getfloat - else: - get = parser.get - - try: - CONFIG[key] = get("retrace", key) - except: - pass - -def free_space(path): - pipe = Popen(["df", path], stdout=PIPE).stdout - for line in pipe.readlines(): - match = DF_OUTPUT_PARSER.match(line) - if match: - pipe.close() - return 1024 * int(match.group(4)) - - pipe.close() - return None - -def unpacked_size(archive): - pipe = Popen(["/usr/local/bin/xz", "--list", "--robot", archive], stdout=PIPE).stdout - for line in pipe.readlines(): - match = XZ_OUTPUT_PARSER.match(line) - if match: - pipe.close() - return int(match.group(4)) - - pipe.close() - return None - -def new_task(): - i = 0 - newdir = CONFIG["WorkDir"] - while os.path.exists(newdir) and i < 50: - i += 1 - taskid = "" - for j in xrange(CONFIG["TaskIdLength"]): - taskid += random.choice(TASKID_ALPHABET) - newdir = CONFIG["WorkDir"] + "/" + taskid - - try: - os.mkdir(newdir) - return taskid, newdir - except: - pass - - return None, None - -def unpack(archive): - pipe = Popen(["tar", "xJf", archive]) - pipe.wait() - return pipe.returncode - -def get_task_password(crashdir): - return "Password for " + crashdir - -def get_task_est_time(crashdir): - return 10 - -def response(start_response, status, body="", extra_headers=[]): - start_response(status, [("Content-Type", "text/plain"), ("Content-Length", str(len(body)))] + extra_headers) - return [body] |
