Branch 'devel' - overseer/command.py overseer/site.conf overseer/static
by Adam Stokes
overseer/command.py | 5 ++-
overseer/site.conf | 7 ++---
overseer/static/Makefile | 2 -
overseer/static/index.html | 53 ++++++++++++++++++++++++++++++++++++++
overseer/static/tmpl/index.html | 55 ----------------------------------------
5 files changed, 61 insertions(+), 61 deletions(-)
New commits:
commit 2851f81ba0c3407ce3af771e0f1bfa55a9651f24
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 11 08:41:39 2010 -0400
fix templating
diff --git a/overseer/command.py b/overseer/command.py
index 139d24e..245c68b 100755
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -60,7 +60,10 @@ def main():
session = Session()
root = Root(session)
current_dir = os.path.dirname(os.path.abspath(__file__))
- cherrypy.quickstart(root, "/", os.path.join(current_dir, 'site.conf'))
+ cherrypy.config.update("site.conf")
+ cherrypy.tree.mount(root, '/', "site.conf")
+ cherrypy.server.quickstart()
+ cherrypy.engine.start()
if __name__=="__main__":
main()
diff --git a/overseer/site.conf b/overseer/site.conf
index 475164a..73bbf7e 100644
--- a/overseer/site.conf
+++ b/overseer/site.conf
@@ -9,9 +9,8 @@ server.socket_port = 8112
server.thread_pool = 10
[/]
-tools.staticdir.root = os.path.join(os.path.dirname(os.path.abspath("site.conf")),"static")
+tools.staticdir.root = "/usr/share/cas/overseer/static"
-
-[/static]
+[/media]
tools.staticdir.on = True
-tools.staticdir.dir = "tmpl"
+tools.staticdir.dir = "blueprint"
diff --git a/overseer/static/Makefile b/overseer/static/Makefile
index e642c36..094d02a 100644
--- a/overseer/static/Makefile
+++ b/overseer/static/Makefile
@@ -11,4 +11,4 @@ install:
mkdir -p $(DESTDIR)$(PKGDIR)/blueprint
mkdir -p $(DESTDIR)$(PKGDIR)/tmpl
install -m644 blueprint/*.css $(DESTDIR)$(PKGDIR)/blueprint/.
- install -m644 tmpl/*.html $(DESTDIR)$(PKGDIR)/tmpl/.
+ install -m644 *.html $(DESTDIR)$(PKGDIR)/.
diff --git a/overseer/static/index.html b/overseer/static/index.html
new file mode 100644
index 0000000..62583eb
--- /dev/null
+++ b/overseer/static/index.html
@@ -0,0 +1,53 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+ <title>CAS - Overseer</title>
+ <link rel="stylesheet" href="/media/screen.css" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="/media/print.css" type="text/css" media="print" />
+ <!--[if lt IE 8]>
+ <link rel="stylesheet" href="/media/blueprint/ie.css" type="text/css" media="screen, projection" />
+ <![endif]-->
+</head>
+<body class="index">
+<div class="container">
+ <h1>CAS - Overseer</h1>
+ <hr />
+ <div class="span-7 colborder">
+ <h6>Navigation</h6>
+ <ul>
+ <li><a href="/">New job</a></li>
+ </ul>
+ <form method="post" id="status_form" action="/status/">
+ <h6>Enter job id</h6>
+ <input type="text" name="jobid" value="" /> <br />
+ <input type="submit" value="Query JOB" />
+ </form>
+ </div>
+ <div class="span-10 colborder">
+ <h4>Setup CAS job</h4>
+ <h6>
+ <span class="notice">
+ </span>
+ </h6>
+ <p>
+ <form method="post" action="/create/">
+ <h6>E-Mail</h6>
+ <input type="text" name="email"/>
+ <h6>Unique ID</h6>
+ <input type="text" name="identifier"/>
+ <h6>vmcore Path ( can be file:/// http:// ftp:// )</h6>
+ <input type="text" name="vmcore" /> <br />
+ <input type="submit" value="Run setup" />
+ </form>
+ </p>
+ </div>
+
+ <div class="span-5 last">
+ <h6>Recent CAS Jobs</h6>
+ </div>
+ <hr/>
+ 2010 Adam Stokes
+</div>
+
+</body>
+</html>
diff --git a/overseer/static/tmpl/index.html b/overseer/static/tmpl/index.html
deleted file mode 100644
index bf0786d..0000000
--- a/overseer/static/tmpl/index.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:py="http://genshi.edgewall.org/">
-
-<head>
- <title>CAS - Overseer</title>
- <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection" />
- <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print" />
- <!--[if lt IE 8]>
- <link rel="stylesheet" href="/media/blueprint/ie.css" type="text/css" media="screen, projection" />
- <![endif]-->
-</head>
-<body class="index">
-<div class="container">
- <h1>CAS - Overseer</h1>
- <hr />
- <div class="span-7 colborder">
- <h6>Navigation</h6>
- <ul>
- <li><a href="/">New job</a></li>
- </ul>
- <form method="post" id="status_form" action="/status/">
- <h6>Enter job id</h6>
- <input type="text" name="jobid" value="" /> <br />
- <input type="submit" value="Query JOB" />
- </form>
- </div>
- <div class="span-10 colborder">
- <h4>Setup CAS job</h4>
- <h6>
- <span class="notice">
- </span>
- </h6>
- <p>
- <form method="post" action="/create/">
- <h6>E-Mail</h6>
- <input type="text" name="email"/>
- <h6>Unique ID</h6>
- <input type="text" name="identifier"/>
- <h6>vmcore Path ( can be file:/// http:// ftp:// )</h6>
- <input type="text" name="vmcore" /> <br />
- <input type="submit" value="Run setup" />
- </form>
- </p>
- </div>
-
- <div class="span-5 last">
- <h6>Recent CAS Jobs</h6>
- </div>
- <hr/>
- 2010 Adam Stokes
-</div>
-
-</body>
-</html>
13 years, 11 months
Branch 'devel' - cas.conf Makefile overseer/command.py overseer/lib overseer/Makefile overseer/site.conf overseer/static overseer/templates
by Adam Stokes
Makefile | 4 --
cas.conf | 2 -
overseer/Makefile | 3 --
overseer/command.py | 37 +++++++-------------------
overseer/lib/Makefile | 17 ------------
overseer/lib/__init__.py | 16 -----------
overseer/lib/template.py | 45 --------------------------------
overseer/site.conf | 17 ++++++++++++
overseer/static/Makefile | 6 ++--
overseer/static/tmpl/index.html | 55 ++++++++++++++++++++++++++++++++++++++++
overseer/templates/Makefile | 12 --------
overseer/templates/index.html | 54 ---------------------------------------
12 files changed, 89 insertions(+), 179 deletions(-)
New commits:
commit 1a42a4e32b621ea13ec494f6c1251e9035da6efc
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Fri May 7 10:35:21 2010 -0400
added site.conf
diff --git a/Makefile b/Makefile
index 833724b..afdcf31 100644
--- a/Makefile
+++ b/Makefile
@@ -8,9 +8,7 @@ SUBDIRS = caslib \
contrib \
snippets \
overseer \
-overseer/lib \
-overseer/static \
-overseer/templates
+overseer/static
PYFILES = $(wildcard *.py)
diff --git a/cas.conf b/cas.conf
index 14b4063..ba5efd2 100644
--- a/cas.conf
+++ b/cas.conf
@@ -37,7 +37,7 @@ workDirectory=/cores
smtphost=mail.example.com
# database connection info
-database=/var/db/cas/cas.db
+database=/var/tmp/cas.db
# send notifications automatically
notify=True
diff --git a/overseer/Makefile b/overseer/Makefile
index 7df6789..7c09fec 100644
--- a/overseer/Makefile
+++ b/overseer/Makefile
@@ -11,10 +11,9 @@ clean:
rm -f *.pyc *.pyo *~
install:
- mkdir -p $(DESTDIR)/$(PKGDIR)/templates
- mkdir -p $(DESTDIR)/$(PKGDIR)/lib
mkdir -p $(DESTDIR)/$(PKGDIR)/static
for p in $(PYFILES) ; do \
install -m 755 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
done
+ install -m 644 site.conf $(DESTDIR)/$(PKGDIR)/.
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
diff --git a/overseer/command.py b/overseer/command.py
index 45c4754..139d24e 100755
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -22,22 +22,20 @@ import os
import cherrypy
import simplejson as json
from caslib.db import *
-from overseer.lib import template
+from mako.template import Template
+from mako.lookup import TemplateLookup
-class Admin:
- pass
+mylookup = TemplateLookup(directories=['static'])
-class Delegate:
- def __init__(self, data, session):
- self.data = data
+class Root:
+ def __init__(self, session):
self.session = session
@cherrypy.expose
- @template.output('index.html')
def index(self):
""" Ability to create/query jobs """
- title = "CAS - Overseer"
- return template.render(title=title)
+ mytemplate = mylookup.get_template("index.html")
+ return mytemplate.render()
@cherrypy.expose
def create(self, **data):
@@ -59,25 +57,10 @@ class Delegate:
pass
def main():
- data = {}
session = Session()
- root = Delegate(data, session)
- root.admin = Admin()
- cherrypy.config.update({
- 'tools.sessions.on': True,
- 'tools.encode.on': True,
- 'tools.encode.encoding': 'utf-8',
- 'tools.decode.on': True,
- 'tools.trailing_slash.on': True,
- 'tools.staticdir.root': os.path.abspath(os.path.dirname(__file__)),
- })
- cherrypy.server.socket_port = 8112
- cherrypy.quickstart(root, '/', {
- '/media': {
- 'tools.staticdir.on': True,
- 'tools.staticdir.dir': 'static'
- }
- })
+ root = Root(session)
+ current_dir = os.path.dirname(os.path.abspath(__file__))
+ cherrypy.quickstart(root, "/", os.path.join(current_dir, 'site.conf'))
if __name__=="__main__":
main()
diff --git a/overseer/lib/Makefile b/overseer/lib/Makefile
deleted file mode 100644
index 21871c9..0000000
--- a/overseer/lib/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-PYTHON=python
-NAME=cas
-PYFILES = $(wildcard *.py)
-PKGDIR = /usr/share/$(NAME)/overseer/lib
-
-all:
- echo "nada"
-
-clean:
- rm -f *.pyc *.pyo *~
-
-install:
- mkdir -p $(DESTDIR)/$(PKGDIR)
- for p in $(PYFILES) ; do \
- install -m 755 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
- done
- $(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
diff --git a/overseer/lib/__init__.py b/overseer/lib/__init__.py
deleted file mode 100644
index db7efdc..0000000
--- a/overseer/lib/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# init.py
-#
-# Copyright (C) 2010 Adam Stokes
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/overseer/lib/template.py b/overseer/lib/template.py
deleted file mode 100644
index d96a35e..0000000
--- a/overseer/lib/template.py
+++ /dev/null
@@ -1,45 +0,0 @@
-import os
-
-import cherrypy
-from genshi.core import Stream
-from genshi.output import encode, get_serializer
-from genshi.template import Context, TemplateLoader
-
-loader = TemplateLoader(
- os.path.join(os.path.dirname(__file__), '..', 'templates'),
- auto_reload=True
-)
-
-def output(filename, method='html', encoding='utf-8', **options):
- """Decorator for exposed methods to specify what template they should use
- for rendering, and which serialization method and options should be
- applied.
- """
- def decorate(func):
- def wrapper(*args, **kwargs):
- cherrypy.thread_data.template = loader.load(filename)
- opt = options.copy()
- if method == 'html':
- opt.setdefault('doctype', 'html')
- serializer = get_serializer(method, **opt)
- stream = func(*args, **kwargs)
- if not isinstance(stream, Stream):
- return stream
- return encode(serializer(stream), method=serializer,
- encoding=encoding)
- return wrapper
- return decorate
-
-def render(*args, **kwargs):
- """Function to render the given data to the template specified via the
- ``@output`` decorator.
- """
- if args:
- assert len(args) == 1, \
- 'Expected exactly one argument, but got %r' % (args,)
- template = loader.load(args[0])
- else:
- template = cherrypy.thread_data.template
- ctxt = Context(url=cherrypy.url)
- ctxt.push(kwargs)
- return template.generate(ctxt)
diff --git a/overseer/site.conf b/overseer/site.conf
new file mode 100644
index 0000000..475164a
--- /dev/null
+++ b/overseer/site.conf
@@ -0,0 +1,17 @@
+[global]
+engine.autoreload_on = True
+tools.sessions.on = True
+tools.encode.on = True
+tools.encode.encoding = "utf-8"
+tools.decode.on = True
+tools.trailing_slash.on = True
+server.socket_port = 8112
+server.thread_pool = 10
+
+[/]
+tools.staticdir.root = os.path.join(os.path.dirname(os.path.abspath("site.conf")),"static")
+
+
+[/static]
+tools.staticdir.on = True
+tools.staticdir.dir = "tmpl"
diff --git a/overseer/static/Makefile b/overseer/static/Makefile
index bbcfa00..e642c36 100644
--- a/overseer/static/Makefile
+++ b/overseer/static/Makefile
@@ -8,5 +8,7 @@ clean:
rm -f *.pyc *.pyo *~
install:
- mkdir -p $(DESTDIR)/$(PKGDIR)/blueprint
- install -m644 blueprint/*.css $(DESTDIR)/$(PKGDIR)/blueprint/.
+ mkdir -p $(DESTDIR)$(PKGDIR)/blueprint
+ mkdir -p $(DESTDIR)$(PKGDIR)/tmpl
+ install -m644 blueprint/*.css $(DESTDIR)$(PKGDIR)/blueprint/.
+ install -m644 tmpl/*.html $(DESTDIR)$(PKGDIR)/tmpl/.
diff --git a/overseer/static/tmpl/index.html b/overseer/static/tmpl/index.html
new file mode 100644
index 0000000..bf0786d
--- /dev/null
+++ b/overseer/static/tmpl/index.html
@@ -0,0 +1,55 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/">
+
+<head>
+ <title>CAS - Overseer</title>
+ <link rel="stylesheet" href="/static/blueprint/screen.css" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="/static/blueprint/print.css" type="text/css" media="print" />
+ <!--[if lt IE 8]>
+ <link rel="stylesheet" href="/media/blueprint/ie.css" type="text/css" media="screen, projection" />
+ <![endif]-->
+</head>
+<body class="index">
+<div class="container">
+ <h1>CAS - Overseer</h1>
+ <hr />
+ <div class="span-7 colborder">
+ <h6>Navigation</h6>
+ <ul>
+ <li><a href="/">New job</a></li>
+ </ul>
+ <form method="post" id="status_form" action="/status/">
+ <h6>Enter job id</h6>
+ <input type="text" name="jobid" value="" /> <br />
+ <input type="submit" value="Query JOB" />
+ </form>
+ </div>
+ <div class="span-10 colborder">
+ <h4>Setup CAS job</h4>
+ <h6>
+ <span class="notice">
+ </span>
+ </h6>
+ <p>
+ <form method="post" action="/create/">
+ <h6>E-Mail</h6>
+ <input type="text" name="email"/>
+ <h6>Unique ID</h6>
+ <input type="text" name="identifier"/>
+ <h6>vmcore Path ( can be file:/// http:// ftp:// )</h6>
+ <input type="text" name="vmcore" /> <br />
+ <input type="submit" value="Run setup" />
+ </form>
+ </p>
+ </div>
+
+ <div class="span-5 last">
+ <h6>Recent CAS Jobs</h6>
+ </div>
+ <hr/>
+ 2010 Adam Stokes
+</div>
+
+</body>
+</html>
diff --git a/overseer/templates/Makefile b/overseer/templates/Makefile
deleted file mode 100644
index ce678e1..0000000
--- a/overseer/templates/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-PKGDIR=/usr/share/cas/overseer
-
-all:
- echo "boo"
-
-clean:
- rm -f *~
-
-install:
- mkdir -p $(DESTDIR)/$(PKGDIR)/static
- mkdir -p $(DESTDIR)/$(PKGDIR)/lib
- install -m644 * $(DESTDIR)/$(PKGDIR)/templates/.
diff --git a/overseer/templates/index.html b/overseer/templates/index.html
deleted file mode 100644
index acf5c38..0000000
--- a/overseer/templates/index.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:xi="http://www.w3.org/2001/XInclude"
- xmlns:py="http://genshi.edgewall.org/">
-
-<head>
- <title>CAS - Overseer</title>
- <link rel="stylesheet" href="/media/blueprint/screen.css" type="text/css" media="screen, projection" />
- <link rel="stylesheet" href="/media/blueprint/print.css" type="text/css" media="print" />
- <!--[if lt IE 8]>
- <link rel="stylesheet" href="/media/blueprint/ie.css" type="text/css" media="screen, projection" />
- <![endif]-->
-</head>
-<body class="index">
-<div class="container">
- <h1>CAS - Overseer</h1>
- <hr />
- <div class="span-7 colborder">
- <h6>Navigation</h6>
- <ul>
- <li><a href="/">New job</a></li>
- </ul>
- <form method="post" id="status_form" action="/status">
- <h6>Enter job id</h6>
- <input type="text" name="jobid" value="" /> <br />
- <input type="submit" value="Query JOB" />
- </form>
- </div>
- <div class="span-10 colborder">
- <h4>Setup CAS job</h4>
- <h6>
- ${ctxt}
- ${defined('req.session')}
- </h6>
-
- <form method="post" action="/create">
- <h6>E-Mail</h6>
- <input type="text" name="email"/>
- <h6>Unique ID</h6>
- <input type="text" name="identifier"/>
- <h6>vmcore Path ( can be file:/// http:// ftp:// )</h6>
- <input type="text" name="vmcore" /> <br />
- <input type="submit" value="Run setup" />
- </form>
- </div>
-
- <div class="span-5 last">
- <h6>Recent CAS Jobs</h6>
- </div>
- <hr/>
- 2010 Adam Stokes
-</div>
-
-</body>
-</html>
13 years, 12 months
Branch 'devel' - overseer/command.py overseer/__init__.py overseer/static overseer/templates
by Adam Stokes
overseer/__init__.py | 3 ---
overseer/command.py | 8 +++++---
overseer/static/Makefile | 1 -
overseer/templates/index.html | 10 ++++++----
4 files changed, 11 insertions(+), 11 deletions(-)
New commits:
commit 916df3c2667b1a2d6f97c89dd8a6d18a138e90f8
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Thu May 6 17:43:40 2010 -0400
grrr genshi being a pain
diff --git a/overseer/__init__.py b/overseer/__init__.py
index a807c09..565cb3b 100644
--- a/overseer/__init__.py
+++ b/overseer/__init__.py
@@ -15,6 +15,3 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import sys
-
-sys.path.append("/usr/share/cas")
diff --git a/overseer/command.py b/overseer/command.py
index beb8294..45c4754 100755
--- a/overseer/command.py
+++ b/overseer/command.py
@@ -40,7 +40,6 @@ class Delegate:
return template.render(title=title)
@cherrypy.expose
- @template.output('index.html')
def create(self, **data):
""" Create job """
if not self.session.query(Job).filter_by(identifier=data['identifier']).first():
@@ -49,8 +48,10 @@ class Delegate:
data['vmcore'])
self.session.add(jobRecord)
self.session.commit()
- msg = "Successfully created Job."
- return template.render(msg=msg)
+ cherrypy.session['status_msg'] = 'Job Posted Successfully'
+ raise cherrypy.HTTPRedirect('/')
+ else:
+ cherrypy.session['status_msg'] = 'Job already exists.'
@cherrypy.expose
def status(self, **data):
@@ -63,6 +64,7 @@ def main():
root = Delegate(data, session)
root.admin = Admin()
cherrypy.config.update({
+ 'tools.sessions.on': True,
'tools.encode.on': True,
'tools.encode.encoding': 'utf-8',
'tools.decode.on': True,
diff --git a/overseer/static/Makefile b/overseer/static/Makefile
index 77ed1f3..bbcfa00 100644
--- a/overseer/static/Makefile
+++ b/overseer/static/Makefile
@@ -8,6 +8,5 @@ clean:
rm -f *.pyc *.pyo *~
install:
- echo "installing static"
mkdir -p $(DESTDIR)/$(PKGDIR)/blueprint
install -m644 blueprint/*.css $(DESTDIR)/$(PKGDIR)/blueprint/.
diff --git a/overseer/templates/index.html b/overseer/templates/index.html
index 7098466..acf5c38 100644
--- a/overseer/templates/index.html
+++ b/overseer/templates/index.html
@@ -12,7 +12,7 @@
</head>
<body class="index">
<div class="container">
- <h1>$title</h1>
+ <h1>CAS - Overseer</h1>
<hr />
<div class="span-7 colborder">
<h6>Navigation</h6>
@@ -27,9 +27,11 @@
</div>
<div class="span-10 colborder">
<h4>Setup CAS job</h4>
- <py:if="msg">
- ${msg}
- </py:if>
+ <h6>
+ ${ctxt}
+ ${defined('req.session')}
+ </h6>
+
<form method="post" action="/create">
<h6>E-Mail</h6>
<input type="text" name="email"/>
13 years, 12 months
Branch 'devel' - caslib/cas.py
by Adam Stokes
caslib/cas.py | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
New commits:
commit 6c0e4d36525e5ec03794208f8deed2c4060f5e1d
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Wed May 5 12:25:11 2010 -0400
fix tracebacks
diff --git a/caslib/cas.py b/caslib/cas.py
index 3dd57ac..210a562 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -80,17 +80,18 @@ if config.has_option("advanced", "buffersize"):
def coreHandler(uri, dst):
dst = os.path.join(dst, os.path.basename(uri))
try:
- grabber.urlgrab(uri, dst)
+ grabber.urlgrab(uri)
except grabber.URLGrabError, e:
genprint(e)
- genprint("Detected a compressed core, extracting.." \
- "please wait as this process can take a " \
- "long time.")
+ shutil.move(uri, dst)
if not coreIsCorefile(dst):
os.chdir(os.path.dirname(dst))
+ genprint("Detected a compressed core, extracting.." \
+ "please wait as this process can take a " \
+ "long time.")
corepath = coreExtract(dst)
if not corepath:
- return _e[3]
+ raise SystemExit(_e[3])
else:
return corepath
else:
@@ -147,7 +148,11 @@ class CasApplication(object):
if not self.opts.filename:
parser.error("A file object is missing.")
else:
- self.filename = self.opts.filename
+ if os.path.isfile(self.opts.filename):
+ self.filename = self.opts.filename
+ else:
+ raise SystemExit(genprint("%s : %s" % (_e[7],
+ self.opts.filename)))
# check if we want to strip the core
if self.opts.strip_core:
14 years
Branch 'devel' - cas-admin cas.conf caslib/cas.py caslib/__init__.py doc/index.rst man/en
by Adam Stokes
cas-admin | 4 +---
cas.conf | 7 -------
caslib/__init__.py | 1 +
caslib/cas.py | 28 ++++++++++++++++------------
doc/index.rst | 5 -----
man/en/cas.conf.5 | 3 ---
6 files changed, 18 insertions(+), 30 deletions(-)
New commits:
commit 7c4a10a7cba44cd7e5d76becd63f181f654f02b7
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 22:33:53 2010 -0400
remove deprecated debugs settings
diff --git a/cas-admin b/cas-admin
index 217e247..deba1c3 100755
--- a/cas-admin
+++ b/cas-admin
@@ -185,8 +185,6 @@ if __name__=="__main__":
genprint("Starting requirement processing and database creation.")
if not os.path.isdir(os.path.dirname(settings["DATABASE"])):
os.makedirs(os.path.dirname(settings["DATABASE"]))
- if not os.path.isdir(settings["DEBUGS"]):
- os.makedirs(settings["DEBUGS"])
# if autopurge is enabled lets clean up some stale data
if AUTOPURGE:
@@ -208,4 +206,4 @@ if __name__=="__main__":
queryServers()
# Got all the pre-reqs out of the way; now build RPM list
- queryLocalRpms(settings["DEBUGS"])
+ queryLocalRpms()
diff --git a/cas.conf b/cas.conf
index 1ffe014..14b4063 100644
--- a/cas.conf
+++ b/cas.conf
@@ -26,13 +26,6 @@ kernels=/mnt/kernels
# kernel debug rpms you wish to search for
rpmFilter=.*kerne.+-debuginfo-[0-9].*\.rpm
-# Define where to store necessary debug information
-# NOTE: This is a temporary storage area for when
-# cpio is run against an rpm and extract the debug kernel
-# for a small amount of time. This could be something like
-# /home/cas/debugs if space permitted
-debugs=/home/cas/debugs
-
# debug level (DEBUG, INFO)
debugLevel=DEBUG
diff --git a/caslib/__init__.py b/caslib/__init__.py
index c42b47c..c6691c9 100644
--- a/caslib/__init__.py
+++ b/caslib/__init__.py
@@ -33,3 +33,4 @@ error_messages = {
# Misc
100 : "This needs root access to run.",
}
+
diff --git a/caslib/cas.py b/caslib/cas.py
index 54bdc16..3dd57ac 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -1,15 +1,19 @@
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# cas.py
+#
+# Copyright (C) 2010 Adam Stokes
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" cas - core accessibility system.
"""
diff --git a/doc/index.rst b/doc/index.rst
index 7a1c955..3b41ede 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -61,7 +61,6 @@ each section and describe its meaning::
sshkey=dss
kernels=/mnt/kernels
rpmFilter=.*kerne.+-debuginfo-[0-9].*\.rpm
- debugs=/cores/debugs
debugLevel=DEBUG
workDirectory=/cores/processed
smtphost=mail.example.com
@@ -85,10 +84,6 @@ any other type of media the cas server can access.
passed to a find command to locate the various kernel-debuginfo packages defined
in ``kernels`` directive.
-``debugs``: (**Required**) A temporary directory in which to store the extracted vmlinux files
-from the kernel-debuginfo packages for processing. Another solution would be to
-alter this to point an existing directory like ``/tmp``, for instance.
-
``debugLevel``: As the name suggest it will set the debug level for CAS output.
Currently the only accepted values are ``DEBUG|INFO``.
diff --git a/man/en/cas.conf.5 b/man/en/cas.conf.5
index 10a301e..e366089 100644
--- a/man/en/cas.conf.5
+++ b/man/en/cas.conf.5
@@ -19,9 +19,6 @@ Location of debug kernels
.B rpmFilter
Regular expression syntax when searching for kernels
.in
-.B debugs
-Temporary storage for extracting debug information
-.in
.B debugLevel
Debug level for logging (DEBUG, INFO)
.in
14 years
Branch 'devel' - caslib/cas.py
by Adam Stokes
caslib/cas.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit c2f72369edb0fe00df4b28e0d1db53b84f31990d
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 20:07:07 2010 -0400
import grabber
diff --git a/caslib/cas.py b/caslib/cas.py
index bd505f4..54bdc16 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -30,7 +30,7 @@ import ConfigParser
import smtplib
import socket
import paramiko
-from urlgrabber import urlgrab
+from urlgrabber import grabber
from datetime import datetime
@@ -76,8 +76,8 @@ if config.has_option("advanced", "buffersize"):
def coreHandler(uri, dst):
dst = os.path.join(dst, os.path.basename(uri))
try:
- urlgrabber.urlgrab(uri, dst)
- except URLGrabError, e:
+ grabber.urlgrab(uri, dst)
+ except grabber.URLGrabError, e:
genprint(e)
genprint("Detected a compressed core, extracting.." \
"please wait as this process can take a " \
14 years
Branch 'devel' - cas-admin caslib/cas.py caslib/core.py
by Adam Stokes
cas-admin | 1 -
caslib/cas.py | 38 ++++++++++++--------------------------
caslib/core.py | 5 ++---
3 files changed, 14 insertions(+), 30 deletions(-)
New commits:
commit e4111a0d93d7dbb6a85d5c47043646317f2dd558
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 20:01:35 2010 -0400
rework corehandler
diff --git a/cas-admin b/cas-admin
index 7f2b2f1..217e247 100755
--- a/cas-admin
+++ b/cas-admin
@@ -76,7 +76,6 @@ def queryLocalRpms(path):
cmd = "find -L %s -iregex %s" % (settings["KERNELS"],
settings["RPMFILTER"])
results, err = casexecute(cmd, True)
-
dst = tempfile.mkdtemp(prefix='cas-')
for rpm in results.split():
rpm_IN_DB = session.query(RPM).filter_by(rpmPath=rpm).first()
diff --git a/caslib/cas.py b/caslib/cas.py
index 779d357..bd505f4 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -73,41 +73,27 @@ BUFFERSIZE=None
if config.has_option("advanced", "buffersize"):
BUFFERSIZE=config.get("advanced", "buffersize")
-def coreHandler(filename, dst):
- # TODO: fix decompression so that it decompresses to
- # workdirectory
- filename = filename
- basename = os.path.basename(filename)
- dst = dst
- currentDirectory = os.path.realpath(os.curdir)
+def coreHandler(uri, dst):
+ dst = os.path.join(dst, os.path.basename(uri))
try:
- urlgrabber.urlgrab(filename)
+ urlgrabber.urlgrab(uri, dst)
except URLGrabError, e:
genprint(e)
genprint("Detected a compressed core, extracting.." \
"please wait as this process can take a " \
"long time.")
- # ok so some decompression utilites like gzip, bzip do not extract
- # files into the `cwd` unless specified with a to-stdout option.
- # this is a pain so we just move everything to `cwd` and proceed
- # from there.
- dst = os.path.join(currentDirectory, basename)
- shutil.move(filename, dst)
- filename = os.path.join(dst, filename)
- corepath = coreExtract(filename)
- if not corepath:
- if coreIsCorefile(filename):
- # No need to proceed to extracting corefile since we assume
- # this is already at the proper stage.
- shutil.move(filename,
- os.path.join(dst, basename))
- filename = os.path.join(dst, basename)
- return filename
- return _e[3]
+ if not coreIsCorefile(dst):
+ os.chdir(os.path.dirname(dst))
+ corepath = coreExtract(dst)
+ if not corepath:
+ return _e[3]
+ else:
+ return corepath
+ else:
+ return dst
# corefile extracted now move it to work directory, pull basename
# from corepath since we auto-detect the core file from extraction
coreBasename = os.path.basename(corepath)
- shutil.move(corepath,os.path.join(dst, coreBasename))
filename = os.path.join(dst, coreBasename)
return filename
diff --git a/caslib/core.py b/caslib/core.py
index 2d01bbf..1a3c1c6 100644
--- a/caslib/core.py
+++ b/caslib/core.py
@@ -50,6 +50,7 @@ def coreFormat(data, fname):
"tbz" : ["tar", "xvjf"],
"bz2" : ["bunzip2", "-q"],
"zip" : ["unzip", "-f"]}
+
# overwrite bz2 item if pbzip2 exists for use of multiple cores
# during compression
if os.path.isfile("/usr/bin/pbzip2"):
@@ -90,8 +91,6 @@ def coreExtract(self, filepath):
return _e[5]
else:
format.append(filepath)
- # TODO: figure out someway to print some status to the screen
- # during extraction
# FIXME: failing to determine corefile after extraction, running
# on extracted core works. possible problem being looking in the wrong
# directory
@@ -102,7 +101,7 @@ def coreExtract(self, filepath):
return False
for root, dirs, files in util.directoryList(dst):
for file in files:
- if isCorefile(file):
+ if coreIsCorefile(file):
return os.path.join(root,file)
return _e[3]
14 years
Branch 'devel' - caslib/cas.py
by Adam Stokes
caslib/cas.py | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
New commits:
commit 61712059ad6efe34277f1d573a0e71e46cc50df4
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 16:04:47 2010 -0400
working on corehandler
diff --git a/caslib/cas.py b/caslib/cas.py
index f2780de..779d357 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -74,18 +74,12 @@ if config.has_option("advanced", "buffersize"):
BUFFERSIZE=config.get("advanced", "buffersize")
def coreHandler(filename, dst):
+ # TODO: fix decompression so that it decompresses to
+ # workdirectory
filename = filename
basename = os.path.basename(filename)
dst = dst
currentDirectory = os.path.realpath(os.curdir)
-
- if coreIsCorefile(filename):
- # No need to proceed to extracting corefile since we assume
- # this is already at the proper stage.
- shutil.move(filename,
- os.path.join(dst, basename))
- filename = os.path.join(dst, basename)
- return filename
try:
urlgrabber.urlgrab(filename)
except URLGrabError, e:
@@ -99,8 +93,16 @@ def coreHandler(filename, dst):
# from there.
dst = os.path.join(currentDirectory, basename)
shutil.move(filename, dst)
- corepath = coreExtract(dst)
+ filename = os.path.join(dst, filename)
+ corepath = coreExtract(filename)
if not corepath:
+ if coreIsCorefile(filename):
+ # No need to proceed to extracting corefile since we assume
+ # this is already at the proper stage.
+ shutil.move(filename,
+ os.path.join(dst, basename))
+ filename = os.path.join(dst, basename)
+ return filename
return _e[3]
# corefile extracted now move it to work directory, pull basename
# from corepath since we auto-detect the core file from extraction
@@ -117,7 +119,7 @@ def timestampHandler(corefile):
raise SystemExit(genprint(err))
# query timestamp table, return tuple debuginfoRPM, and path to
# debugKernel
- timestamp_query = session.query(Timestamp).filter_by(timestamp=timestamp).first()
+ timestamp_query = session.query(Timestamp).filter_by(stampKey=timestamp).first()
if timestamp_query:
return (timestamp_query)
return _e[2]
14 years
Branch 'devel' - caslib/db.py
by Adam Stokes
caslib/db.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 561394713e3740626dda3216661fda048ec8d9f8
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 15:46:35 2010 -0400
add datetime
diff --git a/caslib/db.py b/caslib/db.py
index 2043a14..ece6290 100644
--- a/caslib/db.py
+++ b/caslib/db.py
@@ -15,9 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from datetime import datetime
# Mapper Object
from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
+from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey, DateTime
Base = declarative_base()
class RPM(Base):
__tablename__ = 'rpms'
@@ -49,7 +50,7 @@ class Job(Base):
vmcore = Column(String(255))
path = Column(String(255))
statusId = Column(Integer, ForeignKey("statuses.statusId"))
- created = Column(DateTime)
+ created = Column(DateTime, default=datetime.now)
def __init__(self, identifier, email, vmcore, statusId=1, path=None):
self.identifier = identifier
14 years
Branch 'devel' - cas cas-admin caslib/cas.py caslib/db.py
by Adam Stokes
cas | 1 +
cas-admin | 4 ++--
caslib/cas.py | 33 +++++++++++++++++++++------------
caslib/db.py | 14 +++++++++-----
4 files changed, 33 insertions(+), 19 deletions(-)
New commits:
commit c690762d46af15ad0f240119e297f035162595a0
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Tue May 4 15:44:34 2010 -0400
update session in cas
diff --git a/cas b/cas
index b5d3537..d6a8574 100755
--- a/cas
+++ b/cas
@@ -20,6 +20,7 @@
"""
from caslib.cas import CasApplication
import os
+import sys
if __name__=="__main__":
# Begin CAS
diff --git a/cas-admin b/cas-admin
index c884bde..7f2b2f1 100755
--- a/cas-admin
+++ b/cas-admin
@@ -23,6 +23,8 @@ if sys.version_info[:2] < (2,4):
raise SystemExit("Python >= 2.4 required")
try:
from caslib.db import *
+ # Setup session for db interaction
+ session = Session()
except:
raise SystemExit('Can not interface with database, please check configuration settings' \
'and try again')
@@ -45,8 +47,6 @@ if sys.version_info[:2] < (2,6):
else:
import shutil
-# Setup session for db interaction
-session = Session()
# Read in configuration
config = ConfigParser.ConfigParser()
config.read("/etc/cas.conf")
diff --git a/caslib/cas.py b/caslib/cas.py
index 9bd4897..f2780de 100755
--- a/caslib/cas.py
+++ b/caslib/cas.py
@@ -18,6 +18,7 @@ if sys.version_info[:2] < (2,4):
raise SystemExit("Python >= 2.4 required")
try:
from caslib.db import *
+ session = Session()
except:
raise SystemExit('Can not interface with database, please check ' \
'configuration settings and try again')
@@ -167,18 +168,36 @@ class CasApplication(object):
if err:
return _e[8]
+ # we want to allow for multiple cores under same identifier
+ # so we base the hierarchy /workDirectory/identifier/datetime
+ datenow = datetime.now()
+ dateFormatted = datenow.strftime("%Y.%m.%d.%I.%M.%S")
+
# Not compressing lets continue with validating a identifier
if not self.opts.identifier:
parser.error("A unique identifier number is missing.")
else:
self.identifier = self.opts.identifier
+
+ if not self.opts.email:
+ parser.error("Email is missing")
+ else:
+ self.email = self.opts.email
+
+ self.extractKernelModules = self.opts.kernel_modules
+ self.storagePath = os.path.join(settings["WORKDIRECTORY"],
+ self.identifier)
+ self.storagePath = os.path.join(self.storagePath, dateFormatted)
+
# Add job to database, this allows us to purge
# data based on job date creation then by other
# means. (i.e. identifier == a bugzilla #)
if not self.opts.job:
self.job_record = Job(self.identifier,
- dateFormatted,
- self.email)
+ self.email,
+ self.filename,
+ 1,
+ self.storagePath)
session.add(self.job_record)
session.commit()
else:
@@ -186,16 +205,6 @@ class CasApplication(object):
if not self.job_record:
return _e[40]
- self.email = self.opts.email
- self.extractKernelModules = self.opts.kernel_modules
- # we want to allow for multiple cores under same identifier
- # so we base the hierarchy /workDirectory/identifier/datetime
- datenow = datetime.now()
- dateFormatted = datenow.strftime("%Y.%m.%d.%I.%M.%S")
- self.storagePath = os.path.join(settings["WORKDIRECTORY"],
- self.identifier)
- self.storagePath = os.path.join(self.storagePath, dateFormatted)
-
def run(self):
# setup directory structure
if not os.path.isdir(self.storagePath):
diff --git a/caslib/db.py b/caslib/db.py
index bb3c2a1..2043a14 100644
--- a/caslib/db.py
+++ b/caslib/db.py
@@ -47,19 +47,23 @@ class Job(Base):
identifier = Column(String(100))
email = Column(String(40))
vmcore = Column(String(255))
+ path = Column(String(255))
statusId = Column(Integer, ForeignKey("statuses.statusId"))
+ created = Column(DateTime)
- def __init__(self, identifier, email, vmcore, statusId):
+ def __init__(self, identifier, email, vmcore, statusId=1, path=None):
self.identifier = identifier
self.email = email
self.vmcore = vmcore
self.statusId = statusId
+ self.path = path
def __repr__(self):
- return "<Job('%s','%s','%s','%s')>" % (self.identifier,
- self.email,
- self.vmcore,
- self.statusId)
+ return "<Job('%s','%s','%s','%s','%s')>" % (self.identifier,
+ self.email,
+ self.vmcore,
+ self.statusId,
+ self.path)
class Timestamp(Base):
__tablename__ = 'timestamps'
14 years