Adapt to python 2.6.
From "Tasmanian Devil" <tasm DOT devil AT googlemail DOT com> OK dcoppa@, sthen@, fgsch@
This commit is contained in:
parent
06350e1e36
commit
fdfcc77980
@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.12 2010/10/19 07:43:03 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.13 2010/10/20 11:29:46 dcoppa Exp $
|
||||
|
||||
COMMENT= distributed command execution
|
||||
|
||||
DISTNAME= tentakel-357
|
||||
REVISION = 1
|
||||
REVISION = 2
|
||||
CATEGORIES= sysutils
|
||||
MAINTAINER= Sebastian Stark <seb@todesplanet.de>
|
||||
HOMEPAGE= http://tentakel.biskalar.de/
|
||||
|
26
sysutils/tentakel/patches/patch-py_lekatnet_config_py
Normal file
26
sysutils/tentakel/patches/patch-py_lekatnet_config_py
Normal file
@ -0,0 +1,26 @@
|
||||
$OpenBSD: patch-py_lekatnet_config_py,v 1.1 2010/10/20 11:29:46 dcoppa Exp $
|
||||
--- py/lekatnet/config.py.orig Wed Oct 20 13:06:10 2010
|
||||
+++ py/lekatnet/config.py Wed Oct 20 13:08:06 2010
|
||||
@@ -52,7 +52,7 @@ import pwd
|
||||
import tempfile
|
||||
import sys
|
||||
import tpg
|
||||
-import popen2
|
||||
+from subprocess import Popen, PIPE
|
||||
|
||||
PARAMS = { 'ssh_path': "/usr/bin/ssh",
|
||||
'rsh_path': "/usr/bin/rsh",
|
||||
@@ -265,10 +265,9 @@ class ConfigBase(dict):
|
||||
for dhost in dhosts:
|
||||
if not os.path.isabs(dhost):
|
||||
dhost = os.path.join(_user_dir, dhost)
|
||||
- p = popen2.Popen3(dhost, capturestderr=True)
|
||||
- p.tochild.close()
|
||||
- err = p.childerr.read()
|
||||
- out = p.fromchild.read()
|
||||
+ p = Popen(dhost, stderr=PIPE, stdin=PIPE, stdout=PIPE, close_fds=True, shell=True)
|
||||
+ err = p.stderr.read()
|
||||
+ out = p.stdout.read()
|
||||
status = p.wait() >> 8
|
||||
if err:
|
||||
for line in err.split('\n'):
|
16
sysutils/tentakel/patches/patch-py_lekatnet_plugins_rsh_py
Normal file
16
sysutils/tentakel/patches/patch-py_lekatnet_plugins_rsh_py
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-py_lekatnet_plugins_rsh_py,v 1.1 2010/10/20 11:29:46 dcoppa Exp $
|
||||
--- py/lekatnet/plugins/rsh.py.orig Wed Oct 20 13:15:33 2010
|
||||
+++ py/lekatnet/plugins/rsh.py Wed Oct 20 13:18:22 2010
|
||||
@@ -26,7 +26,11 @@ from lekatnet.remote import registerRemoteCommandPlugi
|
||||
from lekatnet.remote import RemoteCommand
|
||||
import time
|
||||
import random
|
||||
-import md5
|
||||
+
|
||||
+try:
|
||||
+ from hashlib import md5
|
||||
+except ImportError:
|
||||
+ from md5 import new as md5
|
||||
|
||||
class RSHRemoteCommand(RemoteCommand):
|
||||
"RSH remote execution class"
|
30
sysutils/tentakel/patches/patch-py_lekatnet_remote_py
Normal file
30
sysutils/tentakel/patches/patch-py_lekatnet_remote_py
Normal file
@ -0,0 +1,30 @@
|
||||
$OpenBSD: patch-py_lekatnet_remote_py,v 1.3 2010/10/20 11:29:46 dcoppa Exp $
|
||||
--- py/lekatnet/remote.py.orig Wed Oct 20 13:08:11 2010
|
||||
+++ py/lekatnet/remote.py Wed Oct 20 13:09:47 2010
|
||||
@@ -45,7 +45,7 @@ import tpg
|
||||
import time
|
||||
import os
|
||||
import config
|
||||
-from popen2 import Popen3
|
||||
+from subprocess import Popen, PIPE
|
||||
|
||||
|
||||
class FormatString(tpg.Parser):
|
||||
@@ -138,13 +138,10 @@ class RemoteCommand(threading.Thread):
|
||||
#
|
||||
def getstatusoutput(self, cmd):
|
||||
"""Return (status, output) of executing cmd in a shell."""
|
||||
- p = Popen3(cmd, capturestderr=True)
|
||||
- p.tochild.write(self.stdin)
|
||||
- p.tochild.close()
|
||||
- err = p.childerr.read()
|
||||
- p.childerr.close()
|
||||
- text = p.fromchild.read()
|
||||
- p.fromchild.close()
|
||||
+ p = Popen(cmd, stderr=PIPE, stdin=PIPE, stdout=PIPE, close_fds=True, shell=True)
|
||||
+ p.stdin.write(self.stdin)
|
||||
+ err = p.stderr.read()
|
||||
+ text = p.stdout.read()
|
||||
sts = p.wait()
|
||||
if sts is None: sts = 0
|
||||
if text[-1:] == '\n': text = text[:-1]
|
Loading…
Reference in New Issue
Block a user