README | 9 +--------
cas | 4 +++-
cas-admin | 44 +++++++++++++++++---------------------------
cas.conf | 3 +++
lib/cas/network.py | 6 ++++--
lib/cas/rpmutils.py | 1 -
setup.py | 2 +-
7 files changed, 29 insertions(+), 40 deletions(-)
New commits:
commit 42b1661e595c94fc19d5384d878deef5bbf82e35
Author: adam stokes <uzr(a)jak.rebo>
Date: Mon Sep 28 14:58:41 2009 -0400
- more paramiko integration
diff --git a/README b/README
index df865b7..dc8ed76 100644
--- a/README
+++ b/README
@@ -14,14 +14,7 @@ As root run:
# cas-admin -b
-Optional Requirements
-
-func - Please obtain this software from
http://fedorahosted.org/func - setup is
-a breeze and enables cas to do automated core processing on different machine
-for different architectures.
-
-If you have func installed and setup you may re-run cas-admin to populate
-your server database:
+Build your server database:
# cas-admin -s
diff --git a/cas b/cas
index 9423bd7..3e3ade1 100755
--- a/cas
+++ b/cas
@@ -273,7 +273,9 @@ class CasApplication(object):
"crash output" %
(casProcessMachine,))
cmd = "cd " + os.path.join(self.storagePath) +
" && ./crash -i crash.in > crash.out"
# TODO: run command through paramiko
- cmd_return = Executor(hostname, "root").run(cmd)
+ results, err = Executor(hostname,
settings["CASUSER"], cmd).run()
+ if err:
+ self.casLog.debug("Unable to perform results")
else:
self.casLog.info("No servers available for arch and current
system not "\
"suitable for processing, please run cas-admin -h
" \
diff --git a/cas-admin b/cas-admin
index 2558f7b..63d434d 100755
--- a/cas-admin
+++ b/cas-admin
@@ -109,33 +109,20 @@ class CasServerHandler(object):
self.db.buildTable()
def run(self):
- try:
- serverList = {}
- hostname_count = 0
- # TODO: setup paramiko to run through hostname lists and detect archicture.
- for i in minions:
- scheme, netloc, path, query, frag = urlparse.urlsplit(i)
- hostname, port = netloc.split(":")
- client = fc.Overlord(hostname)
- isClientReachable = client.run("test","ping", [])
- if isClientReachable == 1:
- # Returns as
{"hostname":['sts','stdout','stderr']}
- # what a pain
- client_dict = client.command.run("/bin/uname -m")
- # silly magic to get output from command module
- # since we are doing one host at a time we just pull the first
- # key from the dict and parse its return
- sts, arch, err = client_dict[client_dict.keys()[0]]
- if sts:
- self.casLog.debug(err)
- # clean up arch string
- arch = arch.strip()
- self.db.addServer(hostname, arch)
- hostname_count = hostname_count + 1
- self.casLog.info("Server database built with %d server(s) added." %
(hostname_count,))
- except ImportError:
- raise SystemExit(self.casLog.debug("Please install func
(
http://fedorahosted.org/func) for " \
- "an automated machine arch population.\n"))
+ hostname_count = 0
+ if self.server_list and os.path.isfile(self.server_list):
+ fd = open(self.server_list, 'r')
+ for server in fd.readlines():
+ server = server.strip()
+ results, err = Executor(server, settings["CASUSER"],
"/bin/uname -m").run()
+ if err:
+ self.casLog.debug(err)
+ # clean up arch string
+ for i in results:
+ arch = i.strip()
+ self.db.addServer(server, arch)
+ hostname_count = hostname_count + 1
+ self.casLog.info("Server database built with %d server(s) added." %
(hostname_count,))
return
class PurgeHandler(object):
@@ -179,6 +166,8 @@ class CasAdminApplication(object):
parser.add_option("-s","--server",
dest="server_init",
help="Build SERVER DB",
action="store_true",
default=False)
+ parser.add_option("-f", "--serverlist",
dest="server_list",
+ help="Read in line delimeted server list for cas to
propagate")
parser.add_option("-p","--purge",
dest="purgeData",
help="Purge files default 90 days, customize with
-d",
action="store_true", default=False)
@@ -187,6 +176,7 @@ class CasAdminApplication(object):
(self.opts, args) = parser.parse_args()
self.buildDB = self.opts.buildDB
self.server_init = self.opts.server_init
+ self.server_list = self.opts.server_list
self.purgeData = self.opts.purgeData
self.purgeDataDays = self.opts.purgeDataDays
diff --git a/cas.conf b/cas.conf
index b3dcd8d..f3498d6 100644
--- a/cas.conf
+++ b/cas.conf
@@ -10,6 +10,9 @@
# kernels, rpmFilter, debugs, workDirectory, database
[settings]
+# Set the user you wish to run cas as.
+casuser=root
+
# Where kernel-debuginfo packages are stored
# NOTE: this _can_ include symlinked directories, just be careful they are
# indefinately recursive
diff --git a/lib/cas/network.py b/lib/cas/network.py
index 7be14ab..842863c 100644
--- a/lib/cas/network.py
+++ b/lib/cas/network.py
@@ -70,7 +70,7 @@ class Executor(object):
""" using paramiko to perform common tasks over
ssh
"""
- def __init__(self, user, remote_host, cmd):
+ def __init__(self, remote_host, user, cmd):
self.user = user
self.host = remote_host
self.cmd = cmd
@@ -80,4 +80,6 @@ class Executor(object):
def run(self):
stdin, stdout, stderr = self.client.exec_command(self.cmd)
- return (stdin, stdout, stderr)
+ results = stdout.readlines()
+ err = stderr.readlines()
+ return (results, err)
diff --git a/lib/cas/rpmutils.py b/lib/cas/rpmutils.py
index 5a65371..da5dfcb 100644
--- a/lib/cas/rpmutils.py
+++ b/lib/cas/rpmutils.py
@@ -15,7 +15,6 @@ import rpm
import os
import sys
import logging
-import md5
import time
from cas.cas_subprocess import Popen, PIPE
diff --git a/setup.py b/setup.py
index d5aba5b..16773ff 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ for dirpath, dirnames, filenames in os.walk('snippets'):
setup(
name = 'cas',
- version = '0.14',
+ version = '0.15',
author = 'Adam Stokes',
author_email = 'ajs(a)redhat.com',
url = "http://fedorahosted.org/cas",