diff options
Diffstat (limited to 'src/lib/Server/Plugins')
-rw-r--r-- | src/lib/Server/Plugins/Git.py | 6 | ||||
-rw-r--r-- | src/lib/Server/Plugins/SSHbase.py | 8 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Svn.py | 6 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/Server/Plugins/Git.py b/src/lib/Server/Plugins/Git.py index 1c17c8e47..6cb089de6 100644 --- a/src/lib/Server/Plugins/Git.py +++ b/src/lib/Server/Plugins/Git.py @@ -1,4 +1,5 @@ import os +from subprocess import Popen, PIPE import Bcfg2.Server.Plugin # for debugging output only @@ -31,8 +32,9 @@ class Git(Bcfg2.Server.Plugin.Plugin, def get_revision(self): '''Read git revision information for the bcfg2 repository''' try: - data = os.popen("env LC_ALL=C git ls-remote %s" % - (self.datastore)).readlines() + data = Popen(("env LC_ALL=C git ls-remote %s" % + (self.datastore)), shell=True, + stdout=PIPE).stdout.readlines() revline = [line.split('\t')[0].strip() for line in data if \ line.split('\t')[1].strip() == 'refs/heads/master'][-1] revision = revline diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py index 4ca2fdf51..1485df626 100644 --- a/src/lib/Server/Plugins/SSHbase.py +++ b/src/lib/Server/Plugins/SSHbase.py @@ -1,7 +1,11 @@ '''This module manages ssh key files for bcfg2''' __revision__ = '$Revision$' -import binascii, os, socket, tempfile +import binascii +import os +import socket +import tempfile +from subprocess import Popen, PIPE import Bcfg2.Server.Plugin class SSHbase(Bcfg2.Server.Plugin.Plugin, @@ -128,7 +132,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, return (ipaddr, client) except socket.gaierror: cmd = "getent hosts %s" % client - ipaddr = os.popen(cmd).read().strip().split() + ipaddr = Popen(cmd, shell=True, stdout=PIPE).stdout.read().strip().split() if ipaddr: self.ipcache[client] = (ipaddr, client) return (ipaddr, client) diff --git a/src/lib/Server/Plugins/Svn.py b/src/lib/Server/Plugins/Svn.py index 269c3173b..2cdbecb99 100644 --- a/src/lib/Server/Plugins/Svn.py +++ b/src/lib/Server/Plugins/Svn.py @@ -1,4 +1,5 @@ import os +from subprocess import Popen, PIPE import Bcfg2.Server.Plugin # for debugging output only @@ -31,8 +32,9 @@ class Svn(Bcfg2.Server.Plugin.Plugin, def get_revision(self): '''Read svn revision information for the bcfg2 repository''' try: - data = os.popen("env LC_ALL=C svn info %s" \ - % (self.datastore)).readlines() + data = Popen(("env LC_ALL=C svn info %s" % + (self.datastore)), shell=True, + stdout=PIPE).stdout.readlines() revline = [line.split(': ')[1].strip() for line in data \ if line[:9] == 'Revision:'][-1] revision = revline |