summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/server/plugins/probes/fileprobes.txt3
-rw-r--r--man/bcfg2-admin.866
-rw-r--r--man/bcfg2-crypt.883
-rw-r--r--man/bcfg2-ping-sweep.814
-rw-r--r--man/bcfg2.116
-rw-r--r--misc/bcfg2.spec2
-rw-r--r--src/lib/Bcfg2/Logger.py10
-rw-r--r--src/lib/Bcfg2/Options.py55
-rw-r--r--src/lib/Bcfg2/Server/Admin/Init.py2
-rw-r--r--src/lib/Bcfg2/Server/Core.py9
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Hostbase.py23
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Yum.py10
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Pkgmgr.py1
-rw-r--r--src/lib/Bcfg2/settings.py2
-rwxr-xr-xsrc/sbin/bcfg2-crypt8
-rwxr-xr-xsrc/sbin/bcfg2-info2
-rwxr-xr-xsrc/sbin/bcfg2-ping-sweep70
-rw-r--r--tools/manpagegen/bcfg2-admin.8.ronn53
-rw-r--r--tools/manpagegen/bcfg2-ping-sweep.8.ronn16
-rw-r--r--tools/manpagegen/bcfg2.1.ronn12
20 files changed, 289 insertions, 168 deletions
diff --git a/doc/server/plugins/probes/fileprobes.txt b/doc/server/plugins/probes/fileprobes.txt
index 67ed5047e..0baec2c59 100644
--- a/doc/server/plugins/probes/fileprobes.txt
+++ b/doc/server/plugins/probes/fileprobes.txt
@@ -1,5 +1,6 @@
.. _server-plugins-probes-fileprobes:
+==========
FileProbes
==========
@@ -21,7 +22,7 @@ probes from other clients will not modify or overwrite the data in
``info.xml`` for that file are not circumvented.)
Configuration
--------------
+=============
FileProbes is configured in ``FileProbes/config.xml``, which might
look something like:
diff --git a/man/bcfg2-admin.8 b/man/bcfg2-admin.8
index 075aad13d..bed51ff9a 100644
--- a/man/bcfg2-admin.8
+++ b/man/bcfg2-admin.8
@@ -1,5 +1,5 @@
.
-.TH "BCFG2\-ADMIN" "8" "July 2012" "" ""
+.TH "BCFG2\-ADMIN" "8" "August 2012" "" ""
.
.SH "NAME"
\fBbcfg2\-admin\fR \- Perform repository administration tasks
@@ -14,13 +14,45 @@
.
.TP
\fB\-C\fR \fIconfigfile\fR
-Specify alternate bcfg2\.conf location
+Specify alternate bcfg2\.conf location\.
.
-.SH "MODES"
+.TP
+\fB\-E\fR \fIencoding\fR
+Specify the encoding of Cfg files\.
.
.TP
-\fBinit\fR
-Initialize a new repository (interactive)\.
+\fB\-Q\fR \fIrepository path\fR
+Specify the path to the server repository\.
+.
+.TP
+\fB\-S\fR \fIhttps://server:port\fR
+Manually specify the server location (as opposed to using the value in bcfg2\.conf)\.
+.
+.TP
+\fB\-d\fR
+Enable debugging output\.
+.
+.TP
+\fB\-h\fR
+Print Usage information\.
+.
+.TP
+\fB\-o\fR \fIlogfile path\fR
+Writes a log to the specified path\.
+.
+.TP
+\fB\-v\fR
+Enable verbose output\.
+.
+.TP
+\fB\-x\fR \fIpassword\fR
+Use ’password’ for client communication\.
+.
+.TP
+\fB\-\-ssl\-key=\fR\fIssl key\fR
+Specifiy the path to the SSL key\.
+.
+.SH "MODES"
.
.TP
\fBbackup\fR
@@ -35,22 +67,30 @@ Display details about the available bundles (See \fI\fBBUNDLE OPTIONS\fR\fR belo
Add, edit, or remove clients entries in metadata (See \fI\fBCLIENT OPTIONS\fR\fR below)\.
.
.TP
-\fBquery\fR [g=group] [p=profile] [\-f output\-file] [\-n] [\-c]
-Search for clients based on group or profile (See \fI\fBQUERY OPTIONS\fR\fR below)\.
-.
-.TP
\fBcompare\fR \fIold\fR \fInew\fR
Compare two client configurations\. Can be used to verify consistent behavior between releases\. Determine differences between files or directories (See \fI\fBCOMPARE OPTIONS\fR\fR below)\.
.
.TP
+\fBinit\fR
+Initialize a new repository (interactive)\.
+.
+.TP
\fBminestruct\fR \fIclient\fR [\-f xml\-file] [\-g groups]
Build structure entries based on client statistics extra entries (See \fI\fBMINESTRUCT OPTIONS\fR\fR below)\.
.
.TP
+\fBperf\fR
+Query server for performance data\.
+.
+.TP
\fBpull\fR \fIclient\fR \fIentry\-type\fR \fIentry\-name\fR
Install configuration information into repo based on client bad entries (See \fI\fBPULL OPTIONS\fR\fR below)\.
.
.TP
+\fBquery\fR [g=group] [p=profile] [\-f output\-file] [\-n] [\-c]
+Search for clients based on group or profile (See \fI\fBQUERY OPTIONS\fR\fR below)\.
+.
+.TP
\fBreports\fR [init|load_stats|purge|scrub|update]
Interact with the dynamic reporting system (See \fI\fBREPORTS OPTIONS\fR\fR below)\.
.
@@ -59,6 +99,10 @@ Interact with the dynamic reporting system (See \fI\fBREPORTS OPTIONS\fR\fR belo
Interact with the Snapshots database (See \fI\fBSNAPSHOTS OPTIONS\fR\fR below)\.
.
.TP
+\fBsyncdb\fR
+Sync the Django ORM with the configured database\.
+.
+.TP
\fBtidy\fR
Remove unused files from repository\.
.
@@ -66,6 +110,10 @@ Remove unused files from repository\.
\fBviz\fR [\-H] [\-b] [\-k] [\-o png\-file]
Create a graphviz diagram of client, group and bundle information (See \fI\fBVIZ OPTIONS\fR\fR below)\.
.
+.TP
+\fBxcmd\fR
+Provides a XML\-RPC Command Interface to the bcfg2\-server\.
+.
.SS "BUNDLE OPTIONS"
.
.TP
diff --git a/man/bcfg2-crypt.8 b/man/bcfg2-crypt.8
new file mode 100644
index 000000000..a73f3e066
--- /dev/null
+++ b/man/bcfg2-crypt.8
@@ -0,0 +1,83 @@
+.
+.TH "BCFG2\-CRYPT" "8" "August 2012" "" ""
+.
+.SH "NAME"
+\fBbcfg2\-crypt\fR \- Bcfg2 encryption and decryption utility
+.
+.SH "SYNOPSIS"
+\fBbcfg2\-crypt\fR [\fI\-C configfile\fR] [\-\-decrypt|\-\-encrypt] [\-\-cfg|\-\-properties] [\-\-remove] [\-\-xpath \fIxpath\fR] [\-p \fIpassphrase\-or\-name\fR] [\-v] \fIfilename\fR [\fIfilename\fR\.\.\.]
+.
+.SH "DESCRIPTION"
+\fBbcfg2\-crypt\fR performs encryption and decryption of Cfg and Properties files\. It\'s often sufficient to run \fBbcfg2\-crypt\fR with only the name of the file you wish to encrypt or decrypt; it can usually figure out what to do\.
+.
+.SH "OPTIONS"
+.
+.TP
+\fB\-C\fR \fIconfigfile\fR
+Specify alternate bcfg2\.conf location
+.
+.TP
+\fB\-\-decrypt\fR, \fB\-\-encrypt\fR
+Specify which operation you\'d like to perform\. \fBbcfg2\-crypt\fR can usually determine which is necessary based on the contents of each file\.
+.
+.TP
+\fB\-\-cfg\fR
+Tell \fBbcfg2\-crypt\fR that an XML file should be encrypted in its entirety rather than element\-by\-element\. This is only necessary if the file is an XML file whose name ends with \fB\.xml\fR and whose top\-level tag is \fB<Properties>\fR\. See \fIMODES\fR below for details\.
+.
+.TP
+\fB\-\-properties\fR
+Tell \fBbcfg2\-crypt\fR to process a file as an XML Properties file, and encrypt the text of each element separately\. This is necessary if, for example, you\'ve used a different top\-level tag than \fB<Properties>\fR in your Properties files\. See \fIMODES\fR below for details\.
+.
+.TP
+\fB\-\-remove\fR
+Remove the plaintext file after it has been encrypted\. Only meaningful for Cfg files\.
+.
+.TP
+\fB\-\-xpath <xpath>\fR
+Encrypt the character content of all elements that match the specified XPath expression\. The default is \fB*[@encrypted]\fR or \fB*\fR; see \fIMODES\fR below for more details\. Only meaningful for Properties files\.
+.
+.TP
+\fB\-p <passphrase>\fR
+Specify the name of a passphrase specified in the \fB[encryption]\fR section of \fBbcfg2\.conf\fR\. See \fISELECTING PASSPHRASE\fR below for more details\.
+.
+.TP
+\fB\-v\fR
+Be verbose\.
+.
+.TP
+\fB\-h\fR
+Display help and exit\.
+.
+.SH "MODES"
+\fBbcfg2\-crypt\fR can encrypt Cfg files or Properties files; they are handled very differently\.
+.
+.TP
+Cfg
+When \fBbcfg2\-crypt\fR is used on a Cfg file, the entire file is encrypted\. This is the default behavior on files that are not XML, or that are XML but whose top\-level tag is not \fB<Properties>\fR\. This can be enforced by use of the \fB\-\-cfg\fR option\.
+.
+.TP
+Properties
+When \fBbcfg2\-crypt\fR is used on a Properties file, it encrypts the character content of elements matching the XPath expression given by \fB\-\-xpath\fR\. By default the expression is \fB*[@encrypted]\fR, which matches all elements with an \fBencrypted\fR attribute\. If you are encrypting a file and that expression doesn\'t match any elements, then the default is \fB*\fR, which matches everything\. When \fBbcfg2\-crypt\fR encrypts the character content of an element, it also adds the \fBencrypted\fR attribute, set to the name of the passphrase used to encrypt that element\. When it decrypts an element it does not remove \fBencrypted\fR, though; this lets you easily and efficiently run \fBbcfg2\-crypt\fR against a single Properties file to encrypt and decrypt it without needing to specify a long list of options\. See the online Bcfg2 docs on Properties files for more information on how this works\.
+.
+.SH "SELECTING PASSPHRASE"
+The passphrase used to encrypt or decrypt a file is discovered in the following order:
+.
+.IP "\(bu" 4
+First, the passphrase given on the command line using \fB\-p\fR is used\.
+.
+.IP "\(bu" 4
+Next, if exactly one passphrase is specified in \fBbcfg2\.conf\fR, it will be used\.
+.
+.IP "\(bu" 4
+Next, if operating in Properties mode, \fBbcfg2\-crypt\fR will attempt to read the name of the passphrase from the encrypted elements\.
+.
+.IP "\(bu" 4
+Next, if decrypting, all passphrases will be tried sequentially\.
+.
+.IP "\(bu" 4
+If no passphrase has been determined at this point, an error is produced and the file being encrypted or decrypted is skipped\.
+.
+.IP "" 0
+.
+.SH "SEE ALSO"
+bcfg2\-server(8)
diff --git a/man/bcfg2-ping-sweep.8 b/man/bcfg2-ping-sweep.8
deleted file mode 100644
index 709f0eed6..000000000
--- a/man/bcfg2-ping-sweep.8
+++ /dev/null
@@ -1,14 +0,0 @@
-.
-.TH "BCFG2\-PING\-SWEEP" "8" "June 2012" "" ""
-.
-.SH "NAME"
-\fBbcfg2\-ping\-sweep\fR \- Update pingable and pingtime attributes in clients\.xml
-.
-.SH "SYNOPSIS"
-\fBbcfg2\-ping\-sweep\fR
-.
-.SH "DESCRIPTION"
-\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 "SEE ALSO"
-bcfg2(1), bcfg2\-server(8)
diff --git a/man/bcfg2.1 b/man/bcfg2.1
index d0f0e0062..2aa219756 100644
--- a/man/bcfg2.1
+++ b/man/bcfg2.1
@@ -1,5 +1,5 @@
.
-.TH "BCFG2" "1" "June 2012" "" ""
+.TH "BCFG2" "1" "August 2012" "" ""
.
.SH "NAME"
\fBbcfg2\fR \- Bcfg2 client tool
@@ -33,8 +33,12 @@ Upload statistics about the Bcfg2 execution and client state
.SH "OPTIONS"
.
.TP
+\fB\-B\fR
+Configure everything except the given bundle(s)\.
+.
+.TP
\fB\-C\fR \fIconfigfile\fR
-Specify alternate bcfg2\.conf location
+Specify alternate bcfg2\.conf location\.
.
.TP
\fB\-D\fR [\fIdriver1\fR,\fIdriver2\fR]
@@ -53,7 +57,7 @@ Run bcfg2 in interactive mode\. The user will be prompted before each change\.
.
.TP
\fB\-O\fR
-Omit lock check
+Omit lock check\.
.
.TP
\fB\-P\fR
@@ -68,6 +72,10 @@ Specify the number of times that the client will attempt to retry network commun
Manually specify the server location (as opposed to using the value in bcfg2\.conf)\.
.
.TP
+\fB\-Z\fR
+Do not configure independent entries\.
+.
+.TP
\fB\-b\fR [\fIbundle1:bundle2\fR]
Run bcfg2 against one or multiple bundles in the configuration\.
.
@@ -129,7 +137,7 @@ Cause bcfg2 to remove extra configuration elements it detects\. Mode is one of a
.
.TP
\fB\-s\fR \fIservice mode\fR
-Set bcfg2 interaction level for services\. Default behavior is to modify all services affected by reconfiguration\. build mode attempts to stop all services started\. disabled suppresses all attempts to modify services
+Set bcfg2 interaction level for services\. Default behavior is to modify all services affected by reconfiguration\. build mode attempts to stop all services started\. disabled suppresses all attempts to modify services\.
.
.TP
\fB\-\-ssl\-cert=\fR\fIssl cert\fR
diff --git a/misc/bcfg2.spec b/misc/bcfg2.spec
index a86765398..d4d5c5f1c 100644
--- a/misc/bcfg2.spec
+++ b/misc/bcfg2.spec
@@ -1,4 +1,4 @@
-%define release 0.2
+%define release 0.1
%define __python python
%{!?py_ver: %define py_ver %(%{__python} -c 'import sys;print(sys.version[0:3])')}
%define pythonversion %{py_ver}
diff --git a/src/lib/Bcfg2/Logger.py b/src/lib/Bcfg2/Logger.py
index 81b45550f..903209ac3 100644
--- a/src/lib/Bcfg2/Logger.py
+++ b/src/lib/Bcfg2/Logger.py
@@ -57,9 +57,11 @@ class TermiosFormatter(logging.Formatter):
lines = int(math.ceil(float(len(record.msg)) / columns))
for lineNumber in range(lines):
indices = [idx for idx in [(colNum * lines) + lineNumber
- for colNum in range(columns)] if idx < len(record.msg)]
- format = (len(indices) * (" %%-%ds " % columnWidth))
- returns.append(format % tuple([record.msg[idx] for idx in indices]))
+ for colNum in range(columns)]
+ if idx < len(record.msg)]
+ retformat = (len(indices) * (" %%-%ds " % columnWidth))
+ returns.append(retformat % tuple([record.msg[idx]
+ for idx in indices]))
else:
returns.append(str(record.msg))
if record.exc_info:
@@ -86,6 +88,8 @@ class FragmentingSysLogHandler(logging.handlers.SysLogHandler):
error = record.exc_info
record.exc_info = None
msgdata = record.msg
+ if len(msgdata) == 0:
+ return
while msgdata:
newrec = copy.copy(record)
newrec.msg = msgdata[:250]
diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py
index 37781e2ed..e768284b9 100644
--- a/src/lib/Bcfg2/Options.py
+++ b/src/lib/Bcfg2/Options.py
@@ -1,11 +1,12 @@
"""Option parsing library for utilities."""
-import re
-import os
-import sys
import copy
-import shlex
import getopt
+import inspect
+import os
+import re
+import shlex
+import sys
import Bcfg2.Client.Tools
# Compatibility imports
from Bcfg2.Bcfg2Py3k import ConfigParser
@@ -61,7 +62,8 @@ class Option(object):
return value
def __init__(self, desc, default, cmd=False, odesc=False,
- env=False, cf=False, cook=False, long_arg=False):
+ env=False, cf=False, cook=False, long_arg=False,
+ deprecated_cf=None):
self.desc = desc
self.default = default
self.cmd = cmd
@@ -75,6 +77,7 @@ class Option(object):
self.odesc = odesc
self.env = env
self.cf = cf
+ self.deprecated_cf = deprecated_cf
self.boolean = False
if not odesc and not cook and isinstance(self.default, bool):
self.boolean = True
@@ -134,6 +137,15 @@ class Option(object):
return
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
pass
+ if self.deprecated_cf:
+ try:
+ self.value = self.get_cooked_value(configparser.get(*self.deprecated_cf))
+ print "Warning: [%s] %s is deprecated, use [%s] %s instead" % \
+ (self.cf[0], self.cf[1], self.deprecated_cf[0], self.deprecated_cf[1])
+ return
+ except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
+ pass
+
# Default value not cooked
self.value = self.default
@@ -149,8 +161,14 @@ class OptionSet(dict):
self.cfp = DefaultConfigParser()
if (len(self.cfp.read(self.cfile)) == 0 and
('quiet' not in kwargs or not kwargs['quiet'])):
- print("Warning! Unable to read specified configuration file: %s" %
- self.cfile)
+ # suppress warnings if called from bcfg2-admin init
+ caller = inspect.stack()[-1][1].split('/')[-1]
+ if caller == 'bcfg2-admin' and len(sys.argv) > 1:
+ if sys.argv[1] == 'init':
+ return
+ else:
+ print("Warning! Unable to read specified configuration file: %s" %
+ self.cfile)
def buildGetopt(self):
return ''.join([opt.buildGetopt() for opt in list(self.values())])
@@ -428,28 +446,34 @@ SERVER_BACKEND = \
# database options
DB_ENGINE = \
Option('Database engine',
- default='django.db.backends.sqlite3',
- cf=('database', 'engine'))
+ default='sqlite3',
+ cf=('database', 'engine'),
+ deprecated_cf=('statistics', 'database_engine'))
DB_NAME = \
Option('Database name',
default=os.path.join(SERVER_REPOSITORY.default, "bcfg2.sqlite"),
- cf=('database', 'name'))
+ cf=('database', 'name'),
+ deprecated_cf=('statistics', 'database_name'))
DB_USER = \
Option('Database username',
default=None,
- cf=('database', 'user'))
+ cf=('database', 'user'),
+ deprecated_cf=('statistics', 'database_user'))
DB_PASSWORD = \
Option('Database password',
default=None,
- cf=('database', 'password'))
+ cf=('database', 'password'),
+ deprecated_cf=('statistics', 'database_password'))
DB_HOST = \
Option('Database host',
default='localhost',
- cf=('database', 'host'))
+ cf=('database', 'host'),
+ deprecated_cf=('statistics', 'database_host'))
DB_PORT = \
Option('Database port',
default='',
- cf=('database', 'port'),)
+ cf=('database', 'port'),
+ deprecated_cf=('statistics', 'database_port'))
# Django options
DJANGO_TIME_ZONE = \
@@ -459,7 +483,8 @@ DJANGO_TIME_ZONE = \
DJANGO_DEBUG = \
Option('Django debug',
default=None,
- cf=('statistics', 'debug'),)
+ cf=('statistics', 'web_debug'),
+ cook=get_bool,)
# Django options
DJANGO_WEB_PREFIX = \
Option('Web prefix',
diff --git a/src/lib/Bcfg2/Server/Admin/Init.py b/src/lib/Bcfg2/Server/Admin/Init.py
index 65194de06..cbcef3405 100644
--- a/src/lib/Bcfg2/Server/Admin/Init.py
+++ b/src/lib/Bcfg2/Server/Admin/Init.py
@@ -28,7 +28,7 @@ engine = sqlite3
# 'postgresql', 'mysql', 'mysql_old', 'sqlite3' or 'ado_mssql'.
name =
# Or path to database file if using sqlite3.
-#<repository>/etc/brpt.sqlite is default path if left empty
+#<repository>/bcfg2.sqlite is default path if left empty
user =
# Not used with sqlite3.
password =
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index 5b84a334d..660d2c3ef 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -105,13 +105,14 @@ class BaseCore(object):
# verify our database schema
try:
from Bcfg2.Server.SchemaUpdater import update_database, UpdaterError
- update_database()
+ try:
+ update_database()
+ except UpdaterError:
+ self.logger.error("Failed to update database schema")
+ raise CoreInitError
except ImportError:
# assume django is not installed
pass
- except UpdaterError:
- self.logger.error("Failed to update database schema")
- raise CoreInitError
except Exception:
inst = sys.exc_info()[1]
self.logger.error("Failed to update database schema")
diff --git a/src/lib/Bcfg2/Server/Plugins/Hostbase.py b/src/lib/Bcfg2/Server/Plugins/Hostbase.py
index e9c1c1cff..69b019160 100644
--- a/src/lib/Bcfg2/Server/Plugins/Hostbase.py
+++ b/src/lib/Bcfg2/Server/Plugins/Hostbase.py
@@ -3,19 +3,24 @@ This file provides the Hostbase plugin.
It manages dns/dhcp/nis host information
"""
+from lxml.etree import Element, SubElement
import os
+import re
+from time import strftime
os.environ['DJANGO_SETTINGS_MODULE'] = 'Bcfg2.Server.Hostbase.settings'
-from lxml.etree import Element, SubElement
import Bcfg2.Server.Plugin
from Bcfg2.Server.Plugin import PluginExecutionError, PluginInitError
-from time import strftime
-from sets import Set
from django.template import Context, loader
from django.db import connection
-import re
# Compatibility imports
from Bcfg2.Bcfg2Py3k import StringIO
+try:
+ set
+except NameError:
+ # deprecated since python 2.6
+ from sets import Set as set
+
class Hostbase(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.Structure,
@@ -383,7 +388,7 @@ class Hostbase(Bcfg2.Server.Plugin.Plugin,
""")
hostbase = cursor.fetchall()
domains = [host[0].split(".", 1)[1] for host in hostbase]
- domains_set = Set(domains)
+ domains_set = set(domains)
domain_data = [(domain, domains.count(domain)) for domain in domains_set]
domain_data.sort()
@@ -393,7 +398,7 @@ class Hostbase(Bcfg2.Server.Plugin.Plugin,
ips = cursor.fetchall()
three_octets = [ip[0].rstrip('0123456789').rstrip('.') \
for ip in ips]
- three_octets_set = Set(three_octets)
+ three_octets_set = set(three_octets)
three_octets_data = [(octet, three_octets.count(octet)) \
for octet in three_octets_set]
three_octets_data.sort()
@@ -412,7 +417,7 @@ class Hostbase(Bcfg2.Server.Plugin.Plugin,
append_data.append((three_octet, tuple(tosort)))
two_octets = [ip.rstrip('0123456789').rstrip('.') for ip in three_octets]
- two_octets_set = Set(two_octets)
+ two_octets_set = set(two_octets)
two_octets_data = [(octet, two_octets.count(octet))
for octet in two_octets_set]
two_octets_data.sort()
@@ -446,7 +451,7 @@ class Hostbase(Bcfg2.Server.Plugin.Plugin,
else:
if appenddata[0] == ip[0]:
simple = False
- ips.append((appenddata[2], appenddata[0], Set(namelist),
+ ips.append((appenddata[2], appenddata[0], set(namelist),
cnamelist, simple, appenddata[1]))
appenddata = ip
simple = True
@@ -455,7 +460,7 @@ class Hostbase(Bcfg2.Server.Plugin.Plugin,
if ip[4]:
cnamelist.append(ip[4].split('.', 1)[0])
simple = False
- ips.append((appenddata[2], appenddata[0], Set(namelist),
+ ips.append((appenddata[2], appenddata[0], set(namelist),
cnamelist, simple, appenddata[1]))
context = Context({
'subnet': subnet[0],
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
index ce1d9886f..24187d7a9 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py
@@ -1,14 +1,11 @@
import os
import re
import sys
-import time
import copy
-import glob
import socket
import logging
-import threading
import lxml.etree
-from subprocess import Popen, PIPE, STDOUT
+from subprocess import Popen, PIPE
import Bcfg2.Server.Plugin
from Bcfg2.Bcfg2Py3k import StringIO, cPickle, HTTPError, URLError, \
ConfigParser, file
@@ -434,7 +431,7 @@ class YumCollection(Collection):
default="auto"))
if attrs['version'] == 'any':
return attrs
-
+
if pkgtup[1]:
attrs['arch'] = pkgtup[1]
if pkgtup[2]:
@@ -621,7 +618,6 @@ class YumSource(Source):
self.filemap, self.url_map), cache, 2)
cache.close()
-
def load_state(self):
if not self.use_yum:
data = file(self.cachefile)
@@ -636,7 +632,7 @@ class YumSource(Source):
usettings = [{'version':self.version, 'component':comp,
'arch':arch}
for comp in self.components]
- else: # rawurl given
+ else: # rawurl given
usettings = [{'version':self.version, 'component':None,
'arch':arch}]
diff --git a/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py b/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
index 87fac9b1b..7dac907e1 100644
--- a/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
+++ b/src/lib/Bcfg2/Server/Plugins/Pkgmgr.py
@@ -11,6 +11,7 @@ import Bcfg2.Server.Lint
try:
set
except NameError:
+ # deprecated since python 2.6
from sets import Set as set
logger = logging.getLogger('Bcfg2.Plugins.Pkgmgr')
diff --git a/src/lib/Bcfg2/settings.py b/src/lib/Bcfg2/settings.py
index 815a9529b..ae0cff070 100644
--- a/src/lib/Bcfg2/settings.py
+++ b/src/lib/Bcfg2/settings.py
@@ -52,7 +52,7 @@ def read_config(cfile='/etc/bcfg2.conf', repo=None, quiet=False):
repo = setup['repo']
DATABASES['default'] = \
- dict(ENGINE=setup['db_engine'],
+ dict(ENGINE="django.db.backends.%s" % setup['db_engine'],
NAME=setup['db_name'],
USER=setup['db_user'],
PASSWORD=setup['db_password'],
diff --git a/src/sbin/bcfg2-crypt b/src/sbin/bcfg2-crypt
index 89dfe3e2a..79f9e26a2 100755
--- a/src/sbin/bcfg2-crypt
+++ b/src/sbin/bcfg2-crypt
@@ -7,7 +7,13 @@ import logging
import lxml.etree
import Bcfg2.Logger
import Bcfg2.Options
-import Bcfg2.Encryption
+try:
+ import Bcfg2.Encryption
+except ImportError:
+ err = sys.exc_info()[1]
+ print("Import failed '%s'. Is M2Crypto installed?" %
+ err)
+ raise SystemExit(1)
LOGGER = None
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index f3b2aec10..bba8eca7c 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -155,7 +155,7 @@ def load_interpreters():
import IPython
if hasattr(IPython, "Shell"):
interpreters["ipython"] = lambda v: \
- IPython.Shell.IPShell(argv=[], user_ns=v).mainloop
+ IPython.Shell.IPShell(argv=[], user_ns=v).mainloop()
best = "ipython"
elif hasattr(IPython, "embed"):
interpreters["ipython"] = lambda v: IPython.embed(user_ns=v)
diff --git a/src/sbin/bcfg2-ping-sweep b/src/sbin/bcfg2-ping-sweep
deleted file mode 100755
index be8994be3..000000000
--- a/src/sbin/bcfg2-ping-sweep
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-#GenerateHostInfo - Joey Hagedorn - hagedorn@mcs.anl.gov
-
-"""Generates hostinfo.xml at a regular interval."""
-
-from os import dup2, execl, fork, uname, wait
-import sys
-import time
-import lxml.etree
-
-import Bcfg2.Options
-
-if __name__ == '__main__':
- opts = {'repo': Bcfg2.Options.SERVER_REPOSITORY,
- 'configfile': Bcfg2.Options.CFILE}
- setup = Bcfg2.Options.OptionParser(opts)
- setup.parse(sys.argv[1:])
-
- 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")]
-
- pids = {}
- null = open('/dev/null', 'w+')
-
- #use uname to detect OS and use -t for darwin and -w for linux
- #/bin/ping on linux /sbin/ping on os x
- osname = uname()[0]
-
- while hostlist or pids:
- if hostlist and len(list(pids.keys())) < 15:
- host = hostlist.pop()
- pid = fork()
- if pid == 0:
- # in child
- dup2(null.fileno(), sys.__stdin__.fileno())
- dup2(null.fileno(), sys.__stdout__.fileno())
- dup2(null.fileno(), sys.__stderr__.fileno())
- if osname == 'Linux':
- execl('/bin/ping', 'ping', '-w', '5', '-c', '1', host)
- elif osname in ['Darwin', 'FreeBSD']:
- execl('/sbin/ping', 'ping', '-t', '5', '-c', '1', host)
- elif osname == 'SunOS':
- execl('/usr/sbin/ping', 'ping', host, '56', '1')
- else: # default
- execl('/bin/ping', 'ping', '-w', '5', '-c', '1', host)
- else:
- pids[pid] = host
- else:
- try:
- (cpid, status) = wait()
- except OSError:
- continue
- chost = pids[cpid]
- del pids[cpid]
- elm = clientElement.xpath("//Client[@name='%s']" % chost)[0]
- if status == 0:
- elm.set("pingable", 'Y')
- elm.set("pingtime", str(time.time()))
- else:
- elm.set("pingable", 'N')
-
- fout = open(clientdatapath, 'w')
- fout.write(lxml.etree.tostring(clientElement.getroot(),
- encoding='UTF-8',
- xml_declaration=True))
- fout.close()
diff --git a/tools/manpagegen/bcfg2-admin.8.ronn b/tools/manpagegen/bcfg2-admin.8.ronn
index c827265ca..f90865d9c 100644
--- a/tools/manpagegen/bcfg2-admin.8.ronn
+++ b/tools/manpagegen/bcfg2-admin.8.ronn
@@ -12,12 +12,37 @@ bcfg2-admin(8) -- Perform repository administration tasks
## OPTIONS
* `-C` <configfile>:
- Specify alternate bcfg2.conf location
+ Specify alternate bcfg2.conf location.
-## MODES
+ * `-E` <encoding>:
+ Specify the encoding of Cfg files.
- * `init`:
- Initialize a new repository (interactive).
+ * `-Q` <repository path>:
+ Specify the path to the server repository.
+
+ * `-S` <https://server:port>:
+ Manually specify the server location (as opposed to using the value
+ in bcfg2.conf).
+
+ * `-d`:
+ Enable debugging output.
+
+ * `-h`:
+ Print Usage information.
+
+ * `-o` <logfile path>:
+ Writes a log to the specified path.
+
+ * `-v`:
+ Enable verbose output.
+
+ * `-x` <password>:
+ Use ’password’ for client communication.
+
+ * `--ssl-key=`<ssl key>:
+ Specifiy the path to the SSL key.
+
+## MODES
* `backup`:
Create an archive of the entire Bcfg2 repository.
@@ -30,23 +55,29 @@ bcfg2-admin(8) -- Perform repository administration tasks
Add, edit, or remove clients entries in metadata (See [`CLIENT
OPTIONS`](###CLIENT OPTIONS) below).
- * `query` [g=group] [p=profile] [-f output-file] [-n] [-c]:
- Search for clients based on group or profile (See [`QUERY
- OPTIONS`](###QUERY OPTIONS) below).
-
* `compare` <old> <new>:
Compare two client configurations. Can be used to verify consistent
behavior between releases. Determine differences between files or
directories (See [`COMPARE OPTIONS`](###COMPARE OPTIONS) below).
+ * `init`:
+ Initialize a new repository (interactive).
+
* `minestruct` <client> [-f xml-file] [-g groups]:
Build structure entries based on client statistics extra entries
(See [`MINESTRUCT OPTIONS`](###MINESTRUCT OPTIONS) below).
+ * `perf`:
+ Query server for performance data.
+
* `pull` <client> <entry-type> <entry-name>:
Install configuration information into repo based on client bad
entries (See [`PULL OPTIONS`](###PULL OPTIONS) below).
+ * `query` [g=group] [p=profile] [-f output-file] [-n] [-c]:
+ Search for clients based on group or profile (See [`QUERY
+ OPTIONS`](###QUERY OPTIONS) below).
+
* `reports` [init|load_stats|purge|scrub|update]:
Interact with the dynamic reporting system (See [`REPORTS
OPTIONS`](###REPORTS OPTIONS) below).
@@ -55,6 +86,9 @@ bcfg2-admin(8) -- Perform repository administration tasks
Interact with the Snapshots database (See [`SNAPSHOTS
OPTIONS`](###SNAPSHOTS OPTIONS) below).
+ * `syncdb`:
+ Sync the Django ORM with the configured database.
+
* `tidy`:
Remove unused files from repository.
@@ -62,6 +96,9 @@ bcfg2-admin(8) -- Perform repository administration tasks
Create a graphviz diagram of client, group and bundle information
(See [`VIZ OPTIONS`](###VIZ OPTIONS) below).
+ * `xcmd`:
+ Provides a XML-RPC Command Interface to the bcfg2-server.
+
### BUNDLE OPTIONS
* `mode`:
diff --git a/tools/manpagegen/bcfg2-ping-sweep.8.ronn b/tools/manpagegen/bcfg2-ping-sweep.8.ronn
deleted file mode 100644
index 815e0af5b..000000000
--- a/tools/manpagegen/bcfg2-ping-sweep.8.ronn
+++ /dev/null
@@ -1,16 +0,0 @@
-bcfg2-ping-sweep(8) -- Update pingable and pingtime attributes in clients.xml
-=============================================================================
-
-## SYNOPSIS
-
-`bcfg2-ping-sweep`
-
-## DESCRIPTION
-
-`bcfg2-ping-sweep` 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).
-
-## SEE ALSO
-
-bcfg2(1), bcfg2-server(8)
diff --git a/tools/manpagegen/bcfg2.1.ronn b/tools/manpagegen/bcfg2.1.ronn
index c801c833d..8b3ea1e60 100644
--- a/tools/manpagegen/bcfg2.1.ronn
+++ b/tools/manpagegen/bcfg2.1.ronn
@@ -19,8 +19,11 @@ process consists of the following steps.
## OPTIONS
+ * `-B`:
+ Configure everything except the given bundle(s).
+
* `-C` <configfile>:
- Specify alternate bcfg2.conf location
+ Specify alternate bcfg2.conf location.
* `-D` [<driver1>,<driver2>]:
Specify a set of Bcfg2 tool drivers.
@@ -36,7 +39,7 @@ process consists of the following steps.
each change.
* `-O`:
- Omit lock check
+ Omit lock check.
* `-P`:
Run bcfg2 in paranoid mode. Diffs will be logged for configuration
@@ -50,6 +53,9 @@ process consists of the following steps.
Manually specify the server location (as opposed to using the value
in bcfg2.conf).
+ * `-Z`:
+ Do not configure independent entries.
+
* `-b` [_bundle1:bundle2_]:
Run bcfg2 against one or multiple bundles in the configuration.
@@ -120,7 +126,7 @@ process consists of the following steps.
Set bcfg2 interaction level for services. Default behavior is to
modify all services affected by reconfiguration. build mode attempts
to stop all services started. disabled suppresses all attempts to
- modify services
+ modify services.
* `--ssl-cert=`<ssl cert>:
Specifiy the path to the SSL certificate.