summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Neely <jjneely@ncsu.edu>2012-01-09 14:55:08 -0500
committerJack Neely <jjneely@ncsu.edu>2012-01-09 14:55:08 -0500
commit3ed5bad691f5b90885a2c329ec90802d745f52cb (patch)
treeee88932c94f7f78e63825ebda4498eb149f1262e
parent1e1fced1203ae9530c3c629cef94f584e65b66f5 (diff)
parent76be3279f625a2a92832fccbce0274e9be6e72fc (diff)
downloadbcfg2-3ed5bad691f5b90885a2c329ec90802d745f52cb.tar.gz
bcfg2-3ed5bad691f5b90885a2c329ec90802d745f52cb.tar.bz2
bcfg2-3ed5bad691f5b90885a2c329ec90802d745f52cb.zip
Merge branch '1.1.0-stable' of github.com:solj/bcfg2 into 1.1.x
-rw-r--r--debian/changelog6
-rw-r--r--misc/bcfg2.spec2
-rw-r--r--redhat/VERSION2
-rw-r--r--setup.py2
-rw-r--r--solaris/Makefile2
-rw-r--r--solaris/pkginfo.bcfg22
-rw-r--r--solaris/pkginfo.bcfg2-server2
-rw-r--r--src/lib/Server/Admin/Viz.py22
-rw-r--r--src/lib/Server/Plugins/Cfg.py18
-rw-r--r--src/lib/Server/Plugins/Hg.py1
-rw-r--r--src/lib/Server/Plugins/SSHbase.py27
-rw-r--r--src/lib/Server/Plugins/Svn.py3
-rwxr-xr-xsrc/sbin/bcfg2-info2
13 files changed, 59 insertions, 32 deletions
diff --git a/debian/changelog b/debian/changelog
index a17313e6a..725d2edf9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+bcfg2 (1.1.3-0.0) unstable; urgency=low
+
+ * New upstream release
+
+ -- Sol Jerome <sol.jerome@gmail.com> Mon, 19 Sep 2011 19:33:40 -0500
+
bcfg2 (1.1.2-0.0) unstable; urgency=low
* New upstream release
diff --git a/misc/bcfg2.spec b/misc/bcfg2.spec
index ff1b73d85..54a8245e2 100644
--- a/misc/bcfg2.spec
+++ b/misc/bcfg2.spec
@@ -13,7 +13,7 @@
%define lxmldep %(rpm -q %{alt_lxml} 2>&1 > /dev/null && echo %{alt_lxml} || echo %{dfl_lxml})
Name: bcfg2
-Version: 1.1.2
+Version: 1.1.3
Release: %{release}
Summary: Configuration management system
diff --git a/redhat/VERSION b/redhat/VERSION
index 45a1b3f44..781dcb07c 100644
--- a/redhat/VERSION
+++ b/redhat/VERSION
@@ -1 +1 @@
-1.1.2
+1.1.3
diff --git a/setup.py b/setup.py
index d513d32da..49b8ed1b8 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ from glob import glob
setup(cmdclass=cmdclass,
name="Bcfg2",
- version="1.1.2",
+ version="1.1.3",
description="Bcfg2 Server",
author="Narayan Desai",
author_email="desai@mcs.anl.gov",
diff --git a/solaris/Makefile b/solaris/Makefile
index 503337c37..8464737a3 100644
--- a/solaris/Makefile
+++ b/solaris/Makefile
@@ -1,6 +1,6 @@
#!/usr/sfw/bin/gmake
-VERS=1.1.2-1
+VERS=1.1.3-1
PYVERSION := $(shell /opt/csw/bin/python -c "import sys; print sys.version[0:3]")
default: clean package
diff --git a/solaris/pkginfo.bcfg2 b/solaris/pkginfo.bcfg2
index a31162547..80abf8185 100644
--- a/solaris/pkginfo.bcfg2
+++ b/solaris/pkginfo.bcfg2
@@ -1,7 +1,7 @@
PKG="SCbcfg2"
NAME="bcfg2"
ARCH="sparc"
-VERSION="1.1.2"
+VERSION="1.1.3"
CATEGORY="application"
VENDOR="Argonne National Labratory"
EMAIL="bcfg-dev@mcs.anl.gov"
diff --git a/solaris/pkginfo.bcfg2-server b/solaris/pkginfo.bcfg2-server
index c480c114f..231dbf9cf 100644
--- a/solaris/pkginfo.bcfg2-server
+++ b/solaris/pkginfo.bcfg2-server
@@ -1,7 +1,7 @@
PKG="SCbcfg2-server"
NAME="bcfg2-server"
ARCH="sparc"
-VERSION="1.1.2"
+VERSION="1.1.3"
CATEGORY="application"
VENDOR="Argonne National Labratory"
EMAIL="bcfg-dev@mcs.anl.gov"
diff --git a/src/lib/Server/Admin/Viz.py b/src/lib/Server/Admin/Viz.py
index 245ca8398..8ccaf380d 100644
--- a/src/lib/Server/Admin/Viz.py
+++ b/src/lib/Server/Admin/Viz.py
@@ -1,5 +1,6 @@
import getopt
from subprocess import Popen, PIPE
+import pipes
import Bcfg2.Server.Admin
class Viz(Bcfg2.Server.Admin.MetadataCore):
@@ -62,7 +63,8 @@ class Viz(Bcfg2.Server.Admin.MetadataCore):
data = self.Visualize(self.get_repo_path(), hset, bset,
kset, outputfile)
- print data
+ if data:
+ print(data)
raise SystemExit, 0
def Visualize(self, repopath, hosts=False,
@@ -73,11 +75,21 @@ class Viz(Bcfg2.Server.Admin.MetadataCore):
else:
format = 'png'
- cmd = "dot -T%s" % (format)
+ cmd = ["dot", "-T", format]
if output:
- cmd += " -o %s" % output
- dotpipe = Popen(cmd, shell=True, stdin=PIPE,
- stdout=PIPE, close_fds=True)
+ cmd.extend(["-o", output])
+ try:
+ dotpipe = Popen(cmd, stdin=PIPE, stdout=PIPE, close_fds=True)
+ except OSError:
+ # on some systems (RHEL 6), you cannot run dot with
+ # shell=True. on others (Gentoo with Python 2.7), you
+ # must. In yet others (RHEL 5), either way works. I have
+ # no idea what the difference is, but it's kind of a PITA.
+ cmd = ["dot", "-T", pipes.quote(format)]
+ if output:
+ cmd.extend(["-o", pipes.quote(output)])
+ dotpipe = Popen(cmd, shell=True,
+ stdin=PIPE, stdout=PIPE, close_fds=True)
try:
dotpipe.stdin.write("digraph groups {\n")
except:
diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py
index dd1e792ec..07be42c14 100644
--- a/src/lib/Server/Plugins/Cfg.py
+++ b/src/lib/Server/Plugins/Cfg.py
@@ -7,6 +7,7 @@ import lxml
import os
import re
import tempfile
+from subprocess import Popen, PIPE
import Bcfg2.Server.Plugin
@@ -32,17 +33,16 @@ def process_delta(data, delta):
basefile.write(data)
basefile.close()
os.close(basehandle)
- dhandle, dname = tempfile.mkstemp()
- dfile = open(dname, 'w')
- dfile.write(delta.data)
- dfile.close()
- os.close(dhandle)
- ret = os.system("patch -uf %s < %s > /dev/null 2>&1" \
- % (basefile.name, dfile.name))
+
+ cmd = ["patch", "-u", "-f", basefile.name]
+ patch = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ stderr = patch.communicate(input=delta.data)[1]
+ ret = patch.wait()
output = open(basefile.name, 'r').read()
- [os.unlink(fname) for fname in [basefile.name, dfile.name]]
+ os.unlink(basefile.name)
if ret >> 8 != 0:
- raise Bcfg2.Server.Plugin.PluginExecutionError, ('delta', delta)
+ logger.error("Error applying diff %s: %s" % (delta.name, stderr))
+ raise Bcfg2.Server.Plugin.PluginExecutionError('delta', delta)
return output
class CfgMatcher:
diff --git a/src/lib/Server/Plugins/Hg.py b/src/lib/Server/Plugins/Hg.py
index 3f2864a1c..70e33ef1f 100644
--- a/src/lib/Server/Plugins/Hg.py
+++ b/src/lib/Server/Plugins/Hg.py
@@ -1,6 +1,5 @@
import os
from mercurial import ui, hg
-from subprocess import Popen, PIPE
import Bcfg2.Server.Plugin
# for debugging output only
diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py
index 6d68ecb0a..cc9d91dc8 100644
--- a/src/lib/Server/Plugins/SSHbase.py
+++ b/src/lib/Server/Plugins/SSHbase.py
@@ -3,6 +3,7 @@ __revision__ = '$Revision$'
import binascii
import os
+import sys
import socket
import shutil
import tempfile
@@ -162,8 +163,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
self.ipcache[client] = (ipaddr, client)
return (ipaddr, client)
except socket.gaierror:
- cmd = "getent hosts %s" % client
- ipaddr = Popen(cmd, shell=True, \
+ ipaddr = Popen(["getent", "hosts", client],
stdout=PIPE).stdout.read().strip().split()
if ipaddr:
self.ipcache[client] = (ipaddr, client)
@@ -252,19 +252,28 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
"H_%s" % client])
tempdir = tempfile.mkdtemp()
temploc = "%s/%s" % (tempdir, hostkey)
- cmd = 'ssh-keygen -q -f %s -N "" -t %s -C root@%s < /dev/null'
- os.system(cmd % (temploc, keytype, client))
- shutil.copy(temploc, fileloc)
- shutil.copy("%s.pub" % temploc, publoc)
+ cmd = ["ssh-keygen", "-q", "-f", temploc, "-N", "",
+ "-t", keytype, "-C", "root@%s" % client]
+ proc = Popen(cmd, stdout=PIPE, stdin=PIPE)
+ proc.communicate()
+ proc.wait()
+
+ try:
+ shutil.copy(temploc, fileloc)
+ shutil.copy("%s.pub" % temploc, publoc)
+ except IOError:
+ err = sys.exc_info()[1]
+ self.logger.error("Temporary SSH keys not found: %s" % err)
self.AddEntry(hostkey)
- self.AddEntry(".".join([hostkey.split('.')[0]]+['pub', "H_%s" \
- % client]))
+ self.AddEntry("%s.pub.H_%s" % (hostkey.split('.')[0], client))
try:
os.unlink(temploc)
os.unlink("%s.pub" % temploc)
os.rmdir(tempdir)
except OSError:
- self.logger.error("Failed to unlink temporary ssh keys")
+ err = sys.exc_info()[1]
+ self.logger.error("Failed to unlink temporary ssh keys: %s"
+ % err)
def AcceptChoices(self, _, metadata):
return [Bcfg2.Server.Plugin.Specificity(hostname=metadata.hostname)]
diff --git a/src/lib/Server/Plugins/Svn.py b/src/lib/Server/Plugins/Svn.py
index cb4ab649b..9fd6f1051 100644
--- a/src/lib/Server/Plugins/Svn.py
+++ b/src/lib/Server/Plugins/Svn.py
@@ -1,4 +1,5 @@
import os
+import pipes
from subprocess import Popen, PIPE
import Bcfg2.Server.Plugin
@@ -35,7 +36,7 @@ class Svn(Bcfg2.Server.Plugin.Plugin,
"""Read svn revision information for the Bcfg2 repository."""
try:
data = Popen(("env LC_ALL=C svn info %s" %
- (self.datastore)), shell=True,
+ pipes.quote(self.datastore)), shell=True,
stdout=PIPE).communicate()[0].split('\n')
return [line.split(': ')[1] for line in data \
if line[:9] == 'Revision:'][-1]
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index 9721122f3..e9538b769 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -238,7 +238,7 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core):
return
# handle <Path type='file'> entries
- for configfile in [cfile for cfile in client_config.findall(".//Path[@type = 'file']")]:
+ for configfile in client_config.findall(".//Path[@type='file']"):
try:
write_config_file(odir, configfile)
except FileNotBuilt, ex: