diff -Nru bcfg2-1.1.1/debian/changelog bcfg2-1.1.3/debian/changelog
--- bcfg2-1.1.1/debian/changelog 2012-04-18 14:53:38.000000000 +0000
+++ bcfg2-1.1.3/debian/changelog 2012-06-21 19:12:56.000000000 +0000
@@ -1,4 +1,4 @@
-bcfg2 (1.1.1-1ubuntu2~ppa1~lucid2) lucid; urgency=low
+bcfg2 (1.1.3-0ubuntu0~ppa1~lucid1) lucid; urgency=low
* fix locations in BackupPCGen to support more than one location correctly
diff -Nru bcfg2-1.1.1/doc/getting_started/index.txt bcfg2-1.1.3/doc/getting_started/index.txt
--- bcfg2-1.1.1/doc/getting_started/index.txt 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/doc/getting_started/index.txt 2011-09-20 00:33:40.000000000 +0000
@@ -9,7 +9,7 @@
These are many of the resources available to help new users get started.
* For the impatient there is the :ref:`quickstart-index` page.
-* :ref:`gettinghelp` has information when you are troubleshooting or need to ask a question.
+* :ref:`help-index` has information when you are troubleshooting or need to ask a question.
* If you find anything wrong or missing please :ref:`report-a-bug` to let us know.
.. toctree::
diff -Nru bcfg2-1.1.1/doc/server/configurationentries.txt bcfg2-1.1.3/doc/server/configurationentries.txt
--- bcfg2-1.1.1/doc/server/configurationentries.txt 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/doc/server/configurationentries.txt 2011-09-20 00:33:40.000000000 +0000
@@ -5,10 +5,10 @@
.. _Base: plugins/structures/base
.. _Bundler: plugins/structures/bundler
-.. _Cfg: plugins/generators/cfg
+.. _Cfg: plugins/generators/cfg.html
.. _TGenshi: plugins/generators/tgenshi
-.. _TCheetah: plugins/generators/tcheetah
-.. _Rules: plugins/generators/rules
+.. _TCheetah: plugins/generators/tcheetah.html
+.. _Rules: plugins/generators/rules.html
.. _server-configurationentries:
diff -Nru bcfg2-1.1.1/doc/server/plugins/generators/packages.txt bcfg2-1.1.3/doc/server/plugins/generators/packages.txt
--- bcfg2-1.1.1/doc/server/plugins/generators/packages.txt 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/doc/server/plugins/generators/packages.txt 2011-09-20 00:33:40.000000000 +0000
@@ -145,7 +145,7 @@
default. You will notice that the default behavior for apt is
to add Recommended packages as dependencies. You can configure
the Packages plugin to add recommended packages by adding
- the following:
+ the following line immediately following the URL:
.. versionadded:: 1.1.0
diff -Nru bcfg2-1.1.1/man/bcfg2-ping-sweep.8 bcfg2-1.1.3/man/bcfg2-ping-sweep.8
--- bcfg2-1.1.1/man/bcfg2-ping-sweep.8 1970-01-01 00:00:00.000000000 +0000
+++ bcfg2-1.1.3/man/bcfg2-ping-sweep.8 2011-09-20 00:33:40.000000000 +0000
@@ -0,0 +1,20 @@
+.TH "bcfg2-ping-sweep" 8
+.SH NAME
+bcfg2-ping-sweep \- Update pingable and pingtime attributes in
+clients.xml
+.SH SYNOPSIS
+.B bcfg2-ping-sweep
+.SH "DESCRIPTION"
+.PP
+\fBbcfg2-ping-sweep\fR traverses the list of clients in
+Metadata/clients.xml and updates their pingable/pingtime attributes. The
+pingtime value is set to the last time the client was pinged (not the
+RTT value).
+.SH OPTIONS
+.PP
+.B None
+.SH "SEE ALSO"
+.BR bcfg(1),
+.BR bcfg2-server(8)
+.SH "BUGS"
+None currently known
diff -Nru bcfg2-1.1.1/misc/bcfg2.spec bcfg2-1.1.3/misc/bcfg2.spec
--- bcfg2-1.1.1/misc/bcfg2.spec 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/misc/bcfg2.spec 2011-09-20 00:33:40.000000000 +0000
@@ -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.1
+Version: 1.1.3
Release: %{release}
Summary: Configuration management system
diff -Nru bcfg2-1.1.1/osx/macports/files/patch-setup.py.diff bcfg2-1.1.3/osx/macports/files/patch-setup.py.diff
--- bcfg2-1.1.1/osx/macports/files/patch-setup.py.diff 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/osx/macports/files/patch-setup.py.diff 2011-09-20 00:33:40.000000000 +0000
@@ -1,26 +1,26 @@
---- setup.py.orig 2009-11-20 16:07:52.000000000 -0600
-+++ setup.py 2009-11-20 16:29:56.000000000 -0600
-@@ -5,45 +5,19 @@
-
- setup(name="Bcfg2",
- version="1.0.1",
+--- setup.py 2010-11-15 15:30:28.000000000 -0600
++++ setup.py.macports 2010-11-18 19:06:49.155292524 -0600
+@@ -11,47 +11,22 @@
+ setup(cmdclass=cmdclass,
+ name="Bcfg2",
+ version="1.1.1",
- description="Bcfg2 Server",
+ description="Bcfg2 Client",
author="Narayan Desai",
author_email="desai@mcs.anl.gov",
-- packages=["Bcfg2",
-- "Bcfg2.Client",
-+ packages=["Bcfg2.Client",
+- packages=["Bcfg2",
+- "Bcfg2.Client",
++ packages=["Bcfg2.Client",
"Bcfg2.Client.Tools",
-- 'Bcfg2.Server',
+- 'Bcfg2.Server',
- "Bcfg2.Server.Admin",
-- "Bcfg2.Server.Hostbase",
-- "Bcfg2.Server.Hostbase.hostbase",
-- "Bcfg2.Server.Plugins",
-- "Bcfg2.Server.Reports",
+- "Bcfg2.Server.Hostbase",
+- "Bcfg2.Server.Hostbase.hostbase",
+- "Bcfg2.Server.Plugins",
+- "Bcfg2.Server.Reports",
- "Bcfg2.Server.Reports.reports",
- "Bcfg2.Server.Reports.reports.templatetags",
-- "Bcfg2.Server.Snapshots",
+- "Bcfg2.Server.Snapshots",
],
+ py_modules = ["Bcfg2.Options",
+ "Bcfg2.Proxy",
@@ -36,6 +36,9 @@
- ('share/bcfg2/xsl-transforms/xsl-transform-includes',
- glob('reports/xsl-transforms/xsl-transform-includes/*.xsl')),
- ('share/man/man1', glob("man/bcfg2.1")),
++ package_data = {'Bcfg2.Server.Reports.reports':['fixtures/*.xml',
++ 'templates/*.html', 'templates/*/*.html',
++ 'templates/*/*.inc' ] },
+ scripts = glob('src/sbin/bcfg2'),
+ data_files = [('share/man/man1', glob("man/bcfg2.1")),
('share/man/man5', glob("man/*.5")),
@@ -49,7 +52,9 @@
- ('share/bcfg2/Reports/templates/config_items',
- glob('src/lib/Server/Reports/reports/templates/config_items/*')),
- ('share/bcfg2/Hostbase/templates',
-- glob('src/lib/Server/Hostbase/hostbase/webtemplates/*')),
+- glob('src/lib/Server/Hostbase/hostbase/webtemplates/*.*')),
+- ('share/bcfg2/Hostbase/templates/hostbase',
+- glob('src/lib/Server/Hostbase/hostbase/webtemplates/hostbase/*')),
- ('share/bcfg2/Hostbase/repo',
- glob('src/lib/Server/Hostbase/templates/*')),
]
diff -Nru bcfg2-1.1.1/osx/macports/Portfile bcfg2-1.1.3/osx/macports/Portfile
--- bcfg2-1.1.1/osx/macports/Portfile 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/osx/macports/Portfile 2011-09-20 00:33:40.000000000 +0000
@@ -5,10 +5,12 @@
PortGroup python26 1.0
name bcfg2
-license BSD
-version 1.0.1
+version 1.1.1
categories sysutils python
-maintainers ices.utexas.edu:solj
+maintainers gmail.com:sol.jerome
+license BSD
+supported_archs noarch
+
description Bcfg2 configuration management system
long_description Bcfg2 helps system administrators deploy complex \
changes across large numbers of systems in a \
@@ -18,9 +20,8 @@
platforms darwin
master_sites ftp://ftp.mcs.anl.gov/pub/bcfg
-checksums md5 6fbf36acc5cc58b2504a25c25cad3921 \
- sha1 36cac49009c906d4cb61e36a7a8c7b6859518862 \
- rmd160 fae98b10b721d059a9a483e046b83bd61458179d
+checksums sha1 c0214d28796805ff8e3522d348914f366ba860aa \
+ rmd160 2b7d8dfc2e14d1a2def743fe525ee91c5a3d3342
patchfiles patch-setup.py.diff
diff -Nru bcfg2-1.1.1/redhat/VERSION bcfg2-1.1.3/redhat/VERSION
--- bcfg2-1.1.1/redhat/VERSION 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/redhat/VERSION 2011-09-20 00:33:40.000000000 +0000
@@ -1 +1 @@
-1.1.1
+1.1.3
diff -Nru bcfg2-1.1.1/schemas/atom.xsd bcfg2-1.1.3/schemas/atom.xsd
--- bcfg2-1.1.1/schemas/atom.xsd 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/schemas/atom.xsd 2011-09-20 00:33:40.000000000 +0000
@@ -9,7 +9,8 @@
-
+
+
diff -Nru bcfg2-1.1.1/setup.py bcfg2-1.1.3/setup.py
--- bcfg2-1.1.1/setup.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/setup.py 2011-09-20 00:33:40.000000000 +0000
@@ -10,7 +10,7 @@
setup(cmdclass=cmdclass,
name="Bcfg2",
- version="1.1.1",
+ version="1.1.3",
description="Bcfg2 Server",
author="Narayan Desai",
author_email="desai@mcs.anl.gov",
diff -Nru bcfg2-1.1.1/solaris/Makefile bcfg2-1.1.3/solaris/Makefile
--- bcfg2-1.1.1/solaris/Makefile 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/solaris/Makefile 2011-09-20 00:33:40.000000000 +0000
@@ -1,6 +1,6 @@
#!/usr/sfw/bin/gmake
-VERS=1.1.1-1
+VERS=1.1.3-1
PYVERSION := $(shell /opt/csw/bin/python -c "import sys; print sys.version[0:3]")
default: clean package
diff -Nru bcfg2-1.1.1/solaris/pkginfo.bcfg2 bcfg2-1.1.3/solaris/pkginfo.bcfg2
--- bcfg2-1.1.1/solaris/pkginfo.bcfg2 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/solaris/pkginfo.bcfg2 2011-09-20 00:33:40.000000000 +0000
@@ -1,7 +1,7 @@
PKG="SCbcfg2"
NAME="bcfg2"
ARCH="sparc"
-VERSION="1.0.0rc1"
+VERSION="1.1.3"
CATEGORY="application"
VENDOR="Argonne National Labratory"
EMAIL="bcfg-dev@mcs.anl.gov"
diff -Nru bcfg2-1.1.1/solaris/pkginfo.bcfg2-server bcfg2-1.1.3/solaris/pkginfo.bcfg2-server
--- bcfg2-1.1.1/solaris/pkginfo.bcfg2-server 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/solaris/pkginfo.bcfg2-server 2011-09-20 00:33:40.000000000 +0000
@@ -1,7 +1,7 @@
PKG="SCbcfg2-server"
NAME="bcfg2-server"
ARCH="sparc"
-VERSION="1.0.0rc1"
+VERSION="1.1.3"
CATEGORY="application"
VENDOR="Argonne National Labratory"
EMAIL="bcfg-dev@mcs.anl.gov"
diff -Nru bcfg2-1.1.1/src/lib/Client/Tools/Chkconfig.py bcfg2-1.1.3/src/lib/Client/Tools/Chkconfig.py
--- bcfg2-1.1.1/src/lib/Client/Tools/Chkconfig.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Client/Tools/Chkconfig.py 2011-09-20 00:33:40.000000000 +0000
@@ -60,8 +60,8 @@
if not(self.setup.get('dryrun')) and needs_modification:
self.cmd.run('/sbin/service %s %s' % (entry.get('name'),
command))
- pstatus = self.cmd.run('/sbin/service %s status' % \
- entry.get('name'))[0]
+ # service was modified, so it failed
+ pstatus = False
# chkconfig/init.d service
if entry.get('status') == 'on':
diff -Nru bcfg2-1.1.1/src/lib/Client/Tools/YUMng.py bcfg2-1.1.3/src/lib/Client/Tools/YUMng.py
--- bcfg2-1.1.1/src/lib/Client/Tools/YUMng.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Client/Tools/YUMng.py 2011-09-20 00:33:40.000000000 +0000
@@ -350,7 +350,12 @@
for po in packages:
d = {}
for i in ['name', 'epoch', 'version', 'release', 'arch']:
- d[i] = getattr(po, i)
+ if i == 'arch' and getattr(po, i) is None:
+ d[i] = 'noarch'
+ elif i == 'epoch' and getattr(po, i) is None:
+ d[i] = '0'
+ else:
+ d[i] = getattr(po, i)
self.installed.setdefault(po.name, []).append(d)
def VerifyPackage(self, entry, modlist, pinned_version=None):
@@ -448,8 +453,16 @@
self.logger.debug(" Not checking version for virtual package")
_POs = [ po for po in POs ] # Make a copy
elif entry.get('name') == 'gpg-pubkey':
- _POs = [ p for p in POs if p.version == nevra['version'] \
- and p.release == nevra['release'] ]
+ if 'version' not in nevra:
+ m = "Skipping verify: gpg-pubkey without an RPM version."
+ self.logger.warning(m)
+ continue
+ if 'release' not in nevra:
+ m = "Skipping verify: gpg-pubkey without an RPM release."
+ self.logger.warning(m)
+ continue
+ _POs = [p for p in POs if p.version == nevra['version'] \
+ and p.release == nevra['release']]
else:
_POs = self.yb.rpmdb.searchNevra(**snevra)
if len(_POs) == 0:
diff -Nru bcfg2-1.1.1/src/lib/Proxy.py bcfg2-1.1.3/src/lib/Proxy.py
--- bcfg2-1.1.1/src/lib/Proxy.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Proxy.py 2011-09-20 00:33:40.000000000 +0000
@@ -31,7 +31,6 @@
SSL_LIB = 'm2crypto'
-import string
import sys
import time
import urlparse
@@ -43,14 +42,17 @@
__all__ = ["ComponentProxy", "RetryMethod", "SSLHTTPConnection", "XMLRPCTransport"]
+
class CertificateError(Exception):
def __init__(self, commonName):
self.commonName = commonName
+
class RetryMethod(_Method):
"""Method with error handling and retries built in."""
log = logging.getLogger('xmlrpc')
max_retries = 4
+
def __call__(self, *args):
for retry in range(self.max_retries):
try:
@@ -84,6 +86,7 @@
# sorry jon
xmlrpclib._Method = RetryMethod
+
class SSLHTTPConnection(httplib.HTTPConnection):
"""Extension of HTTPConnection that implements SSL and related behaviors."""
@@ -156,7 +159,6 @@
else:
raise Exception, "No SSL module support"
-
def _connect_py26ssl(self):
"""Initiates a connection using the ssl module."""
rawsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -173,7 +175,7 @@
other_side_required = ssl.CERT_NONE
self.logger.warning("No ca is specified. Cannot authenticate the server with SSL.")
if self.cert and not self.key:
- self.logger.warning("SSL cert specfied, but key. Cannot authenticate this client with SSL.")
+ self.logger.warning("SSL cert specfied, but no key. Cannot authenticate this client with SSL.")
self.cert = None
if self.key and not self.cert:
self.logger.warning("SSL key specfied, but no cert. Cannot authenticate this client with SSL.")
@@ -218,7 +220,7 @@
# authentication to the server
ctx.load_cert(self.cert, self.key)
elif self.cert:
- self.logger.warning("SSL cert specfied, but key. Cannot authenticate this client with SSL.")
+ self.logger.warning("SSL cert specfied, but no key. Cannot authenticate this client with SSL.")
elif self.key:
self.logger.warning("SSL key specfied, but no cert. Cannot authenticate this client with SSL.")
@@ -240,7 +242,8 @@
class XMLRPCTransport(xmlrpclib.Transport):
- def __init__(self, key=None, cert=None, ca=None, scns=None, use_datetime=0, timeout=90):
+ def __init__(self, key=None, cert=None, ca=None,
+ scns=None, use_datetime=0, timeout=90):
if hasattr(xmlrpclib.Transport, '__init__'):
xmlrpclib.Transport.__init__(self, use_datetime)
self.key = key
@@ -250,7 +253,7 @@
self.timeout = timeout
def make_connection(self, host):
- host = self.get_host_info(host)[0]
+ host, self._extra_headers = self.get_host_info(host)[0:2]
http = SSLHTTPConnection(host, key=self.key, cert=self.cert, ca=self.ca,
scns=self.scns, timeout=self.timeout)
https = httplib.HTTP()
@@ -295,7 +298,9 @@
return u.close()
-def ComponentProxy(url, user=None, password=None, key=None, cert=None, ca=None,
+
+def ComponentProxy(url, user=None, password=None,
+ key=None, cert=None, ca=None,
allowedServerCNs=None, timeout=90):
"""Constructs proxies to components.
@@ -312,5 +317,6 @@
newurl = "%s://%s:%s@%s" % (method, user, password, path)
else:
newurl = url
- ssl_trans = XMLRPCTransport(key, cert, ca, allowedServerCNs, timeout=timeout)
+ ssl_trans = XMLRPCTransport(key, cert, ca,
+ allowedServerCNs, timeout=timeout)
return xmlrpclib.ServerProxy(newurl, allow_none=True, transport=ssl_trans)
diff -Nru bcfg2-1.1.1/src/lib/Server/Admin/Viz.py bcfg2-1.1.3/src/lib/Server/Admin/Viz.py
--- bcfg2-1.1.1/src/lib/Server/Admin/Viz.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Server/Admin/Viz.py 2011-09-20 00:33:40.000000000 +0000
@@ -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 @@
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 @@
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 -Nru bcfg2-1.1.1/src/lib/Server/Plugins/Cfg.py bcfg2-1.1.3/src/lib/Server/Plugins/Cfg.py
--- bcfg2-1.1.1/src/lib/Server/Plugins/Cfg.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Server/Plugins/Cfg.py 2011-09-20 00:33:40.000000000 +0000
@@ -7,6 +7,7 @@
import os
import re
import tempfile
+from subprocess import Popen, PIPE
import Bcfg2.Server.Plugin
@@ -32,17 +33,16 @@
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 -Nru bcfg2-1.1.1/src/lib/Server/Plugins/Hg.py bcfg2-1.1.3/src/lib/Server/Plugins/Hg.py
--- bcfg2-1.1.1/src/lib/Server/Plugins/Hg.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Server/Plugins/Hg.py 2011-09-20 00:33:40.000000000 +0000
@@ -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 -Nru bcfg2-1.1.1/src/lib/Server/Plugins/Metadata.py bcfg2-1.1.3/src/lib/Server/Plugins/Metadata.py
--- bcfg2-1.1.1/src/lib/Server/Plugins/Metadata.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Server/Plugins/Metadata.py 2011-09-20 00:33:40.000000000 +0000
@@ -9,6 +9,7 @@
import os.path
import socket
import time
+import Bcfg2.Server.FileMonitor
import Bcfg2.Server.Plugin
class MetadataConsistencyError(Exception):
@@ -83,6 +84,8 @@
except:
print("Unable to add file monitor for groups.xml or clients.xml")
raise Bcfg2.Server.Plugin.PluginInitError
+
+ self.pseudo_monitor = isinstance(core.fam, Bcfg2.Server.FileMonitor.Pseudo)
self.states = {}
if watch_clients:
self.states = {"groups.xml":False, "clients.xml":False}
@@ -285,7 +288,7 @@
continue
else:
break
- tree.write(client_tree)
+ tree.write(client_tree, pretty_print=True)
fcntl.lockf(fd, fcntl.LOCK_UN)
client_tree.close()
@@ -307,7 +310,7 @@
continue
else:
break
- tree.write(client_tree)
+ tree.write(client_tree, pretty_print=True)
fcntl.lockf(fd, fcntl.LOCK_UN)
client_tree.close()
@@ -460,6 +463,13 @@
if profile not in self.public:
self.logger.error("Failed to set client %s to private group %s" % (client, profile))
raise MetadataConsistencyError
+ if self.pseudo_monitor:
+ # if we aren't using fam reload the clients.xml file in case its changed
+ try:
+ self.clientdata_original = lxml.etree.parse(self.data + "/clients.xml")
+ except Exception, e:
+ self.logger.error("Metadata: Failed to relad clients.xml. %s" % e)
+ raise MetadataConsistencyError
if client in self.clients:
self.logger.info("Changing %s group from %s to %s" % (client, self.clients[client], profile))
cli = self.clientdata_original.xpath('.//Client[@name="%s"]' % (client))
@@ -490,14 +500,6 @@
raise MetadataRuntimeError
# prep data
dataroot = self.clientdata_original.getroot()
- if hasattr(dataroot, 'iter'):
- items = dataroot.iter()
- else:
- items = dataroot.getchildren()
- for item in items:
- # no items have text data of any sort
- item.tail = None
- item.text = None
newcontents = lxml.etree.tostring(dataroot, pretty_print=True)
fd = datafile.fileno()
@@ -735,6 +737,13 @@
client = meta.hostname
if client in self.auth and self.auth[client] == 'bootstrap':
self.logger.info("Asserting client %s auth mode to cert" % client)
+ if self.pseudo_monitor:
+ # if we aren't using fam reload the clients.xml file in case its changed
+ try:
+ self.clientdata_original = lxml.etree.parse(self.data + "/clients.xml")
+ except Exception, e:
+ self.logger.error("Metadata: Failed to relad clients.xml. %s" % e)
+ raise MetadataConsistencyError
cli = self.clientdata_original.xpath('.//Client[@name="%s"]' \
% (client))
cli[0].set('auth', 'cert')
@@ -745,7 +754,7 @@
groups_tree = lxml.etree.parse(self.data + "/groups.xml")
try:
groups_tree.xinclude()
- except lxml.etree.XincludeError:
+ except lxml.etree.XIncludeError:
self.logger.error("Failed to process XInclude for file %s" % dest)
groups = groups_tree.getroot()
categories = {'default':'grey83'}
diff -Nru bcfg2-1.1.1/src/lib/Server/Plugins/Packages.py bcfg2-1.1.3/src/lib/Server/Plugins/Packages.py
--- bcfg2-1.1.1/src/lib/Server/Plugins/Packages.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Server/Plugins/Packages.py 2011-09-20 00:33:40.000000000 +0000
@@ -278,12 +278,12 @@
sdata = self.packages.values()
self.packages['global'] = copy.deepcopy(sdata.pop())
while sdata:
- self.packages['global'].intersection(sdata.pop())
+ self.packages['global'] = self.packages['global'].intersection(sdata.pop())
for key in self.packages:
if key == 'global':
continue
- self.packages[key] = self.packages['global'].difference(self.packages[key])
+ self.packages[key] = self.packages[key].difference(self.packages['global'])
self.save_state()
def parse_filelist(self, data, arch):
diff -Nru bcfg2-1.1.1/src/lib/Server/Plugins/SSHbase.py bcfg2-1.1.3/src/lib/Server/Plugins/SSHbase.py
--- bcfg2-1.1.1/src/lib/Server/Plugins/SSHbase.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Server/Plugins/SSHbase.py 2011-09-20 00:33:40.000000000 +0000
@@ -3,6 +3,7 @@
import binascii
import os
+import sys
import socket
import shutil
import tempfile
@@ -162,8 +163,7 @@
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 @@
"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 -Nru bcfg2-1.1.1/src/lib/Server/Plugins/Svn.py bcfg2-1.1.3/src/lib/Server/Plugins/Svn.py
--- bcfg2-1.1.1/src/lib/Server/Plugins/Svn.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/Server/Plugins/Svn.py 2011-09-20 00:33:40.000000000 +0000
@@ -1,4 +1,5 @@
import os
+import pipes
from subprocess import Popen, PIPE
import Bcfg2.Server.Plugin
@@ -35,7 +36,7 @@
"""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 -Nru bcfg2-1.1.1/src/lib/SSLServer.py bcfg2-1.1.3/src/lib/SSLServer.py
--- bcfg2-1.1.1/src/lib/SSLServer.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/lib/SSLServer.py 2011-09-20 00:33:40.000000000 +0000
@@ -262,10 +262,12 @@
self.logger.warning("Connection dropped from %s" % self.client_address[0])
elif str(type) == 'socket.error' and msg[0] == 104:
self.logger.warning("Connection reset by peer: %s" % self.client_address[0])
+ elif str(type) == 'ssl.SSLError':
+ self.logger.warning("SSLError handling client %s: %s" % \
+ (self.client_address[0], msg))
else:
self.logger.error("Error sending response (%s): %s" % \
(type, msg))
- raise
def finish(self):
# shut down the connection
diff -Nru bcfg2-1.1.1/src/sbin/bcfg2 bcfg2-1.1.3/src/sbin/bcfg2
--- bcfg2-1.1.1/src/sbin/bcfg2 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/sbin/bcfg2 2011-09-20 00:33:40.000000000 +0000
@@ -104,6 +104,8 @@
if (self.setup["file"] != False) and (self.setup["cache"] != False):
print("cannot use -f and -c together")
raise SystemExit(1)
+ if not self.setup['server'].startswith('https://'):
+ self.setup['server'] = 'https://' + self.setup['server']
def run_probe(self, probe):
"""Execute probe."""
diff -Nru bcfg2-1.1.1/src/sbin/bcfg2-info bcfg2-1.1.3/src/sbin/bcfg2-info
--- bcfg2-1.1.1/src/sbin/bcfg2-info 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/sbin/bcfg2-info 2011-09-20 00:33:40.000000000 +0000
@@ -238,7 +238,7 @@
return
# handle 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:
diff -Nru bcfg2-1.1.1/src/sbin/bcfg2-ping-sweep bcfg2-1.1.3/src/sbin/bcfg2-ping-sweep
--- bcfg2-1.1.1/src/sbin/bcfg2-ping-sweep 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/sbin/bcfg2-ping-sweep 2011-09-20 00:33:40.000000000 +0000
@@ -8,7 +8,7 @@
from os import dup2, execl, fork, uname, wait
import sys
import time
-import lxml.etree
+import lxml.etree
import Bcfg2.Options
@@ -20,9 +20,10 @@
cfpath = setup['configfile']
clientdatapath = "%s/Metadata/clients.xml" % setup['repo']
-
+
clientElement = lxml.etree.parse(clientdatapath)
- hostlist = [client.get('name') for client in clientElement.findall("Client")]
+ hostlist = [client.get('name')
+ for client in clientElement.findall("Client")]
pids = {}
null = open('/dev/null', 'w+')
@@ -31,7 +32,6 @@
#/bin/ping on linux /sbin/ping on os x
osname = uname()[0]
-
while hostlist or pids:
if hostlist and len(pids.keys()) < 15:
host = hostlist.pop()
@@ -47,7 +47,7 @@
execl('/sbin/ping', 'ping', '-t', '5', '-c', '1', host)
elif osname == 'SunOS':
execl('/usr/sbin/ping', 'ping', host, '56', '1')
- else: #default
+ else: # default
execl('/bin/ping', 'ping', '-w', '5', '-c', '1', host)
else:
pids[pid] = host
@@ -58,14 +58,15 @@
continue
chost = pids[cpid]
del pids[cpid]
- elm = clientElement.xpath("//Client[@name='%s']"%chost)[0]
+ elm = clientElement.xpath("//Client[@name='%s']" % chost)[0]
if status == 0:
- elm.set("pingable",'Y')
+ elm.set("pingable", 'Y')
elm.set("pingtime", str(time.time()))
else:
- elm.set("pingable",'N')
+ elm.set("pingable", 'N')
fout = open(clientdatapath, 'w')
- fout.write(lxml.etree.tostring(clientElement.getroot(), encoding='UTF-8', xml_declaration=True))
+ fout.write(lxml.etree.tostring(clientElement.getroot(),
+ encoding='UTF-8',
+ xml_declaration=True))
fout.close()
-
diff -Nru bcfg2-1.1.1/src/sbin/bcfg2-reports bcfg2-1.1.3/src/sbin/bcfg2-reports
--- bcfg2-1.1.1/src/sbin/bcfg2-reports 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/src/sbin/bcfg2-reports 2011-09-20 00:33:40.000000000 +0000
@@ -227,7 +227,7 @@
for c_inst in c_list:
baditems = c_inst.current_interaction.bad()
for item in baditems:
- if item.name == badentry[1] and item.kind == badentry[0]:
+ if item.entry.name == badentry[1] and item.entry.kind == badentry[0]:
result.append(c_inst)
if c_inst in entrydict:
entrydict.get(c_inst).append(badentry[1])
@@ -238,7 +238,7 @@
for c_inst in c_list:
baditems = c_inst.current_interaction.bad()
for item in baditems:
- if item.name == badentry[1] and item.kind == badentry[0]:
+ if item.entry.name == badentry[1] and item.entry.kind == badentry[0]:
result.append(c_inst)
break
elif extraentry != "":
@@ -249,7 +249,7 @@
for c_inst in c_list:
extraitems = c_inst.current_interaction.extra()
for item in extraitems:
- if item.name == extraentry[1] and item.kind == extraentry[0]:
+ if item.entry.name == extraentry[1] and item.entry.kind == extraentry[0]:
result.append(c_inst)
if c_inst in entrydict:
entrydict.get(c_inst).append(extraentry[1])
@@ -260,7 +260,7 @@
for c_inst in c_list:
extraitems = c_inst.current_interaction.extra()
for item in extraitems:
- if item.name == extraentry[1] and item.kind == extraentry[0]:
+ if item.entry.name == extraentry[1] and item.entry.kind == extraentry[0]:
result.append(c_inst)
break
diff -Nru bcfg2-1.1.1/tools/export.py bcfg2-1.1.3/tools/export.py
--- bcfg2-1.1.1/tools/export.py 2010-11-15 21:30:28.000000000 +0000
+++ bcfg2-1.1.3/tools/export.py 2011-09-20 00:33:40.000000000 +0000
@@ -59,6 +59,14 @@
if line.startswith('VERS='):
line = line.replace(line, 'VERS=%s-1\n' % version)
sys.stdout.write(line)
+for line in fileinput.input('solaris/pkginfo.bcfg2', inplace=1):
+ if line.startswith('VERSION='):
+ line = line.replace(line, 'VERSION="%s"\n' % version)
+ sys.stdout.write(line)
+for line in fileinput.input('solaris/pkginfo.bcfg2-server', inplace=1):
+ if line.startswith('VERSION='):
+ line = line.replace(line, 'VERSION="%s"\n' % version)
+ sys.stdout.write(line)
# tag the release
#FIXME: do this using python-dulwich