diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-02-06 13:34:20 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-02-06 13:34:20 +0000 |
commit | 746457e805247b652c8206e3ecf641ecff8305f8 (patch) | |
tree | a1e3cac6e5c75869b5336d416656ba8c94ecc4f5 | |
parent | 37401bf9e4b9f627662af7b9d1f50937eea2c99d (diff) | |
download | bcfg2-746457e805247b652c8206e3ecf641ecff8305f8.tar.gz bcfg2-746457e805247b652c8206e3ecf641ecff8305f8.tar.bz2 bcfg2-746457e805247b652c8206e3ecf641ecff8305f8.zip |
Client tools infrastructure update for python 2.6 (From Kamil Kisiel)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5067 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | src/lib/Client/Tools/__init__.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/Client/Tools/__init__.py b/src/lib/Client/Tools/__init__.py index d44356f9b..ad0740992 100644 --- a/src/lib/Client/Tools/__init__.py +++ b/src/lib/Client/Tools/__init__.py @@ -9,16 +9,24 @@ __all__ = ["Action", "APT", "Blast", "Chkconfig", "DebInit", "Encap", drivers = [item for item in __all__ if item not in ['rpmtools']] default = [item for item in drivers if item not in ['RPM', 'Yum']] -import os, popen2, stat, sys, Bcfg2.Client.XML, time +import os +try: + from subprocess import Popen +except: + from popen2 import Popen4 as Popen +import stat +import sys +import time +import Bcfg2.Client.XML class toolInstantiationError(Exception): '''This error is called if the toolset cannot be instantiated''' pass -class readonlypipe(popen2.Popen4): +class readonlypipe(Popen): '''This pipe sets up stdin --> /dev/null''' def __init__(self, cmd, bufsize=-1): - popen2._cleanup() + self.__module__._cleanup() c2pread, c2pwrite = os.pipe() null = open('/dev/null', 'w+') self.pid = os.fork() @@ -31,7 +39,7 @@ class readonlypipe(popen2.Popen4): self._run_child(cmd) os.close(c2pwrite) self.fromchild = os.fdopen(c2pread, 'r', bufsize) - popen2._active.append(self) + self.__module__._active.append(self) class executor: '''this class runs stuff for us''' |