cas | 3 ++-
cas-admin | 6 ++----
cas.spec | 12 ++++++++----
lib/cas/network.py | 17 +++++++++++++++++
4 files changed, 29 insertions(+), 9 deletions(-)
New commits:
commit e74048977697933ea595a8b97e4b327fd3275b6d
Author: adam stokes <uzr(a)jak.rebo>
Date: Mon Sep 28 12:26:10 2009 -0400
- start reworking ssh code to use paramiko instead of func
diff --git a/cas b/cas
index f4e3f9d..87519aa 100755
--- a/cas
+++ b/cas
@@ -24,7 +24,7 @@ import socket
from cas.cas_subprocess import Popen, PIPE
from datetime import datetime
-from cas.network import Download, CasNetworkException
+from cas.network import Download, Executor, CasNetworkException
from cas.core import CoreBase, CoreException
from cas.db import CasStorage, CasStorageException
from cas.util import UtilBase, Logging
@@ -274,6 +274,7 @@ 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)
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 2e575d8..728a6f5 100755
--- a/cas-admin
+++ b/cas-admin
@@ -28,6 +28,7 @@ from cas.rpmutils import RPMBase
from cas.db import CasStorage, CasStorageException
from cas.cas_subprocess import Popen, PIPE
from cas.cas_shutil import rmtree
+from cas.network import Executor
if sys.version_info[:2] < (2,3):
raise SystemExit("Python >= 2.3 required")
@@ -113,10 +114,7 @@ class CasServerHandler(object):
try:
serverList = {}
hostname_count = 0
- # Attempt to load func to automate detection of machine arch
- import func.overlord.client as fc
- parent_func = fc.Overlord("*")
- minions = parent_func.minions
+ # 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(":")
diff --git a/cas.spec b/cas.spec
index 708bbcc..cc57342 100644
--- a/cas.spec
+++ b/cas.spec
@@ -12,9 +12,9 @@ BuildArch: noarch
Url:
http://fedorahosted.org/cas
BuildRequires: python-devel
%if 0%{?rhel}
-Requires: python-sqlite crash PyYAML
+Requires: python-sqlite crash python-paramiko
%else
-Requires: crash python-paramiko PyYAML
+Requires: crash python-paramiko
%endif
%description
@@ -50,7 +50,7 @@ rm -rf ${RPM_BUILD_ROOT}
%changelog
* Tue Sep 15 2009 Adam Stokes <ajs at redhat dot com> - 0.15-1
-- Require PyYAML, paramiko
+- Require paramiko for all remote executions
- Rip out func code
* Tue May 5 2009 Adam Stokes <ajs at redhat dot com> - 0.14-8
diff --git a/lib/cas/network.py b/lib/cas/network.py
index a14d9ff..7be14ab 100644
--- a/lib/cas/network.py
+++ b/lib/cas/network.py
@@ -15,6 +15,7 @@ import sys
import os
import urlparse
import urlgrabber.grabber as grabber
+import paramiko
class CasNetworkException(Exception): pass
@@ -64,3 +65,19 @@ class Download(object):
f.close()
url.close()
return self.output
+
+class Executor(object):
+ """ using paramiko to perform common tasks over
+ ssh
+ """
+ def __init__(self, user, remote_host, cmd):
+ self.user = user
+ self.host = remote_host
+ self.cmd = cmd
+ self.client = paramiko.SSHClient()
+ self.client.load_system_host_keys()
+ self.client.connect(self.host, username=self.user)
+
+ def run(self):
+ stdin, stdout, stderr = self.client.exec_command(self.cmd)
+ return (stdin, stdout, stderr)
commit c0a56cbf52e0f5d4fa8862a59e5d5665ad71d80c
Author: adam stokes <uzr(a)jak.rebo>
Date: Mon Sep 28 12:00:00 2009 -0400
- updated spec
diff --git a/cas.spec b/cas.spec
index 462ae10..708bbcc 100644
--- a/cas.spec
+++ b/cas.spec
@@ -2,8 +2,8 @@
Name: cas
Summary: Tool to analyze and configure core file environment
-Version: 0.14
-Release: 10%{?dist}
+Version: 0.15
+Release: 1%{?dist}
Source0:
https://fedorahosted.org/releases/c/a/cas/%{name}-%{version}.tar.gz
License: GPLv3+
Group: Development/Libraries
@@ -12,9 +12,9 @@ BuildArch: noarch
Url:
http://fedorahosted.org/cas
BuildRequires: python-devel
%if 0%{?rhel}
-Requires: python-sqlite crash
+Requires: python-sqlite crash PyYAML
%else
-Requires: crash
+Requires: crash python-paramiko PyYAML
%endif
%description
@@ -49,6 +49,10 @@ rm -rf ${RPM_BUILD_ROOT}
%doc AUTHORS LICENSE README PKG-INFO doc/*
%changelog
+* Tue Sep 15 2009 Adam Stokes <ajs at redhat dot com> - 0.15-1
+- Require PyYAML, paramiko
+- Rip out func code
+
* Tue May 5 2009 Adam Stokes <ajs at redhat dot com> - 0.14-8
- support for purging old data
- documentation updated to reflect updated workflow and describe