summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Cvs.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-14 13:05:08 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-14 13:05:08 -0400
commit3d06f311274d6b942ee89d8cdb13b2ecc99af1b0 (patch)
treebc3d6403e053f0e30f525c6555bd00dd0d0c973e /src/lib/Bcfg2/Server/Plugins/Cvs.py
parentacb1dde9ba48b04d1ceb701ce849e96cef3d0070 (diff)
downloadbcfg2-3d06f311274d6b942ee89d8cdb13b2ecc99af1b0.tar.gz
bcfg2-3d06f311274d6b942ee89d8cdb13b2ecc99af1b0.tar.bz2
bcfg2-3d06f311274d6b942ee89d8cdb13b2ecc99af1b0.zip
use Executor class for better subprocess calling on server
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Cvs.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cvs.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Cvs.py b/src/lib/Bcfg2/Server/Plugins/Cvs.py
index ba1559a1a..0054a8a37 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cvs.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cvs.py
@@ -1,7 +1,7 @@
""" The Cvs plugin provides a revision interface for Bcfg2 repos using
cvs. """
-from subprocess import Popen, PIPE
+from Bcfg2.Utils import Executor
import Bcfg2.Server.Plugin
@@ -13,20 +13,17 @@ class Cvs(Bcfg2.Server.Plugin.Version):
def __init__(self, core, datastore):
Bcfg2.Server.Plugin.Version.__init__(self, core, datastore)
+ self.cmd = Executor()
self.logger.debug("Initialized cvs plugin with CVS directory %s" %
self.vcs_path)
def get_revision(self):
"""Read cvs revision information for the Bcfg2 repository."""
+ result = self.cmd.run(["env LC_ALL=C", "cvs", "log"],
+ shell=True, cwd=self.vcs_root)
try:
- data = Popen("env LC_ALL=C cvs log",
- shell=True,
- cwd=self.vcs_root,
- stdout=PIPE).stdout.readlines()
- return data[3].strip('\n')
- except IndexError:
- msg = "Failed to read CVS log"
+ return result.stdout.splitlines()[0].strip()
+ except (IndexError, AttributeError):
+ msg = "Failed to read revision from CVS: %s" % result.error
self.logger.error(msg)
- self.logger.error('Ran command "cvs log" from directory %s' %
- self.vcs_root)
raise Bcfg2.Server.Plugin.PluginExecutionError(msg)