summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2013-03-18 18:26:27 -0500
committerSol Jerome <sol.jerome@gmail.com>2013-03-18 18:26:27 -0500
commitaeb0bcfe0ef10bb24bc5198ae6b281924d6ca88f (patch)
treef83eaeea83f7710fac6cbed11b786331647644b0
parente0d8251f2b8cb315b8124d2733aaab90b9f7e2a2 (diff)
parent4f6ba35fd86ae748d77557936e39db162cc282e3 (diff)
downloadbcfg2-aeb0bcfe0ef10bb24bc5198ae6b281924d6ca88f.tar.gz
bcfg2-aeb0bcfe0ef10bb24bc5198ae6b281924d6ca88f.tar.bz2
bcfg2-aeb0bcfe0ef10bb24bc5198ae6b281924d6ca88f.zip
Merge branch 'maint'
-rw-r--r--doc/exts/xmlschema.py7
-rw-r--r--doc/man/bcfg2.conf.txt12
-rw-r--r--doc/man/bcfg2.txt9
-rw-r--r--doc/reports/dynamic.txt14
-rw-r--r--man/bcfg2-admin.85
-rw-r--r--man/bcfg2-build-reports.85
-rw-r--r--man/bcfg2-crypt.85
-rw-r--r--man/bcfg2-info.85
-rw-r--r--man/bcfg2-lint.85
-rw-r--r--man/bcfg2-lint.conf.55
-rw-r--r--man/bcfg2-reports.85
-rw-r--r--man/bcfg2-server.85
-rw-r--r--man/bcfg2.114
-rw-r--r--man/bcfg2.conf.541
-rw-r--r--src/lib/Bcfg2/Client/Tools/POSIX/base.py2
-rw-r--r--src/lib/Bcfg2/Compat.py3
-rw-r--r--src/lib/Bcfg2/Options.py10
-rw-r--r--src/lib/Bcfg2/Proxy.py7
-rw-r--r--src/lib/Bcfg2/Reporting/templates/widgets/filter_bar.html2
-rw-r--r--src/lib/Bcfg2/Server/Admin/Init.py22
-rw-r--r--src/lib/Bcfg2/Server/models.py3
-rwxr-xr-xsrc/sbin/bcfg2-test4
-rwxr-xr-xtools/export.py38
-rwxr-xr-xtools/upgrade/1.3/migrate_info.py6
-rwxr-xr-x[-rw-r--r--]tools/upgrade/1.3/migrate_perms_to_mode.py4
25 files changed, 154 insertions, 84 deletions
diff --git a/doc/exts/xmlschema.py b/doc/exts/xmlschema.py
index 727b4bbd0..24cbf2e2d 100644
--- a/doc/exts/xmlschema.py
+++ b/doc/exts/xmlschema.py
@@ -76,6 +76,11 @@ from sphinx.util.nodes import make_refnode, split_explicit_title, \
from sphinx.util.compat import Directive
from sphinx.domains import ObjType, Domain
+try:
+ from new import classobj
+except ImportError:
+ classobj = type
+
XS = "http://www.w3.org/2001/XMLSchema"
XS_NS = "{%s}" % XS
NSMAP = dict(xs=XS)
@@ -653,7 +658,7 @@ def append_node(parent, cls_or_node, *contents):
def build_node(cls_or_node, *contents):
- if isinstance(cls_or_node, type):
+ if isinstance(cls_or_node, (type, classobj)):
rv = cls_or_node()
else:
rv = cls_or_node
diff --git a/doc/man/bcfg2.conf.txt b/doc/man/bcfg2.conf.txt
index d8f2bc3df..3a0217aef 100644
--- a/doc/man/bcfg2.conf.txt
+++ b/doc/man/bcfg2.conf.txt
@@ -729,11 +729,21 @@ control the database connection of the server.
port
Port for database connections. Not used for sqlite3.
+Reporting options
+-----------------
+
+ config
+ Specifies the location of the reporting configuration (default
+ is /etc/bcfg2-web.conf.
+
time_zone
- Specify a time zone other than that used on the system. (Note
+ Specifies a time zone other than that used on the system. (Note
that this will cause the Bcfg2 server to log messages in this
time zone as well).
+ web_debug
+ Turn on Django debugging.
+
See Also
--------
diff --git a/doc/man/bcfg2.txt b/doc/man/bcfg2.txt
index 6a77a4a3c..6df4f9b4f 100644
--- a/doc/man/bcfg2.txt
+++ b/doc/man/bcfg2.txt
@@ -88,10 +88,13 @@ Options
the constraints of correctness, and thus should only
be used in safe conditions.
-r mode Cause bcfg2 to remove extra configuration elements
- it detects. Mode is one of "all", "Services", or
- "Packages". "all" removes all entries. Likewise,
- "Services" and "Packages" remove only the extra
+ it detects. Mode is one of "all", "Services",
+ "Packages", or "Users". "all" removes all extra entries.
+ "Services", "Packages", and "Users" remove only the extra
configuration elements of the respective type.
+ ("Services" actually just disables extra services,
+ since they can't be removed, and "Users" removes
+ extra POSIXUser and POSIXUser entries.)
-s servicemode Set bcfg2 interaction level for services. Default
behavior is to modify all services affected by
reconfiguration. "build" mode attempts to stop all
diff --git a/doc/reports/dynamic.txt b/doc/reports/dynamic.txt
index 19c947a71..14eff6f54 100644
--- a/doc/reports/dynamic.txt
+++ b/doc/reports/dynamic.txt
@@ -166,20 +166,22 @@ Upgrading
2. Replace the DBStats plugin with the Reporting plugin.
3. Migrate historic data.
- Run `tools/upgrade/1.3/migrate_dbstats.py`
+ Run ``tools/upgrade/1.3/migrate_dbstats.py``
The reporting schema is now managed using `South <http://south.aeracode.org>`_
instead of a set of custom scripts. This creates the new schema and imports
all of the historic data to the new format.
-.. Note:
+ .. note::
- After the database is upgraded all of the old tables are left intact. To
- remove them any table starting with reports_ can be dropped.
+ After the database is upgraded all of the old tables are left
+ intact. To remove them any table starting with reports_ can
+ be dropped.
4. `(Optional)` Run the :ref:`Report Collector <report_collector>`
- Add "transport = LocalFilesystem" under "[reporting]" in `bcfg2.conf`.
- Restart the bcfg2-server and start the bcfg2-report-collector.
+ Add "transport = LocalFilesystem" under "[reporting]" in
+ ``bcfg2.conf``. Restart the bcfg2-server and start the
+ bcfg2-report-collector.
Configuring
===========
diff --git a/man/bcfg2-admin.8 b/man/bcfg2-admin.8
index 279ee7e0b..06cbeec0b 100644
--- a/man/bcfg2-admin.8
+++ b/man/bcfg2-admin.8
@@ -1,4 +1,4 @@
-.TH "BCFG2-ADMIN" "8" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2-ADMIN" "8" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2-admin \- Perform repository administration tasks
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
@@ -249,5 +249,4 @@ Add a shape/color key.
.sp
\fIbcfg2\-info(8)\fP, \fIbcfg2\-server(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2-build-reports.8 b/man/bcfg2-build-reports.8
index 8d3d58ebb..3b4582820 100644
--- a/man/bcfg2-build-reports.8
+++ b/man/bcfg2-build-reports.8
@@ -1,4 +1,4 @@
-.TH "BCFG2-BUILD-REPORTS" "8" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2-BUILD-REPORTS" "8" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2-build-reports \- Generate state reports for Bcfg2 clients
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
@@ -58,5 +58,4 @@ default is \fBrepo/etc/statistics.xml\fP.
.sp
\fIbcfg2(1)\fP, \fIbcfg2\-server(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2-crypt.8 b/man/bcfg2-crypt.8
index 7c11eb66c..3cdef3f84 100644
--- a/man/bcfg2-crypt.8
+++ b/man/bcfg2-crypt.8
@@ -1,4 +1,4 @@
-.TH "BCFG2-CRYPT" "8" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2-CRYPT" "8" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2-crypt \- Bcfg2 encryption and decryption utility
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
@@ -150,5 +150,4 @@ produced and the file being encrypted or decrypted is skipped.
.sp
\fIbcfg2\-server(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2-info.8 b/man/bcfg2-info.8
index ee650b5da..a52194372 100644
--- a/man/bcfg2-info.8
+++ b/man/bcfg2-info.8
@@ -1,4 +1,4 @@
-.TH "BCFG2-INFO" "8" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2-INFO" "8" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2-info \- Creates a local version of the Bcfg2 server core for state observation
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
@@ -136,5 +136,4 @@ Print version of this tool.
.sp
\fIbcfg2(1)\fP, \fIbcfg2\-server(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2-lint.8 b/man/bcfg2-lint.8
index c81c305f1..22632f5dd 100644
--- a/man/bcfg2-lint.8
+++ b/man/bcfg2-lint.8
@@ -1,4 +1,4 @@
-.TH "BCFG2-LINT" "8" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2-LINT" "8" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2-lint \- Check Bcfg2 specification for validity, common mistakes, and style
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
@@ -143,5 +143,4 @@ than by a mix of Cfg and TGenshi or TCheetah.
\fIbcfg2(1)\fP, \fIbcfg2\-server(8)\fP,
\fIbcfg2\-lint.conf(5)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2-lint.conf.5 b/man/bcfg2-lint.conf.5
index d6d299616..a2b34e601 100644
--- a/man/bcfg2-lint.conf.5
+++ b/man/bcfg2-lint.conf.5
@@ -1,4 +1,4 @@
-.TH "BCFG2-LINT.CONF" "5" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2-LINT.CONF" "5" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2-lint.conf \- Configuration parameters for bcfg2-lint
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH DESCRIPTION
.sp
@@ -158,5 +158,4 @@ The full path to the XML Schema files. Default is
.sp
\fIbcfg2\-lint(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2-reports.8 b/man/bcfg2-reports.8
index 7b1622a5e..6d0db36fa 100644
--- a/man/bcfg2-reports.8
+++ b/man/bcfg2-reports.8
@@ -1,4 +1,4 @@
-.TH "BCFG2-REPORTS" "8" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2-REPORTS" "8" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2-reports \- Query reporting system for client status
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
@@ -142,5 +142,4 @@ specified file instead of the command line.
.sp
\fIbcfg2(1)\fP, \fIbcfg2\-server(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2-server.8 b/man/bcfg2-server.8
index 8df8ebfd5..27f6a7b01 100644
--- a/man/bcfg2-server.8
+++ b/man/bcfg2-server.8
@@ -1,4 +1,4 @@
-.TH "BCFG2-SERVER" "8" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2-SERVER" "8" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2-server \- Server for client configuration specifications
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
@@ -76,5 +76,4 @@ Specify the path to the SSL key.
.sp
\fIbcfg2(1)\fP, \fIbcfg2\-lint(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2.1 b/man/bcfg2.1
index 1e0f526c8..5b9449fda 100644
--- a/man/bcfg2.1
+++ b/man/bcfg2.1
@@ -1,4 +1,4 @@
-.TH "BCFG2" "1" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2" "1" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2 \- Bcfg2 client tool
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
@@ -164,10 +164,13 @@ be used in safe conditions.
.TP
.BI \-r \ mode
Cause bcfg2 to remove extra configuration elements
-it detects. Mode is one of "all", "Services", or
-"Packages". "all" removes all entries. Likewise,
-"Services" and "Packages" remove only the extra
+it detects. Mode is one of "all", "Services",
+"Packages", or "Users". "all" removes all extra entries.
+"Services", "Packages", and "Users" remove only the extra
configuration elements of the respective type.
+("Services" actually just disables extra services,
+since they can\(aqt be removed, and "Users" removes
+extra POSIXUser and POSIXUser entries.)
.TP
.BI \-s \ servicemode
Set bcfg2 interaction level for services. Default
@@ -206,5 +209,4 @@ Only configure independent entries, ignore bundles.
.sp
\fIbcfg2\-server(8)\fP, \fIbcfg2\-info(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/man/bcfg2.conf.5 b/man/bcfg2.conf.5
index 0a982b8f0..b0db91a5b 100644
--- a/man/bcfg2.conf.5
+++ b/man/bcfg2.conf.5
@@ -1,4 +1,4 @@
-.TH "BCFG2.CONF" "5" "January 14, 2013" "1.3" "Bcfg2"
+.TH "BCFG2.CONF" "5" "March 18, 2013" "1.3" "Bcfg2"
.SH NAME
bcfg2.conf \- Configuration parameters for Bcfg2
.
@@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.\" Man page generated from reStructeredText.
+.\" Man page generated from reStructuredText.
.
.SH DESCRIPTION
.sp
@@ -62,6 +62,8 @@ the \fIbcfg2\-admin init\fP command.
The file monitor used to watch for changes in the repository. The
default is the best available monitor. The following values are
valid:
+.INDENT 7.0
+.INDENT 3.5
.sp
.nf
.ft C
@@ -71,10 +73,14 @@ fam
pseudo
.ft P
.fi
+.UNINDENT
+.UNINDENT
.TP
.B ignore_files
A comma\-separated list of globs that should be ignored by the file
monitor. Default values are:
+.INDENT 7.0
+.INDENT 3.5
.sp
.nf
.ft C
@@ -90,6 +96,8 @@ SCCS
\&.gitignore
.ft P
.fi
+.UNINDENT
+.UNINDENT
.TP
.B listen_all
This setting tells the server to listen on all available interfaces.
@@ -99,6 +107,8 @@ bcfg2 setting in the components section of \fBbcfg2.conf\fP.
.B plugins
A comma\-delimited list of enabled server plugins. Currently
available plugins are:
+.INDENT 7.0
+.INDENT 3.5
.sp
.nf
.ft C
@@ -145,6 +155,8 @@ TGenshi
Trigger
.ft P
.fi
+.UNINDENT
+.UNINDENT
.sp
Descriptions of each plugin can be found in their respective
sections below.
@@ -156,6 +168,8 @@ default location (e.g. \fB/usr/local\fP).
.B backend
Specifies which server core backend to use. Current available
options are:
+.INDENT 7.0
+.INDENT 3.5
.sp
.nf
.ft C
@@ -164,6 +178,8 @@ builtin
best
.ft P
.fi
+.UNINDENT
+.UNINDENT
.sp
The default is \fIbest\fP, which is currently an alias for \fIbuiltin\fP.
More details on the backends can be found in the official
@@ -725,6 +741,8 @@ control the database connection of the server.
.B engine
The database engine used by the statistics module. One of the
following:
+.INDENT 7.0
+.INDENT 3.5
.sp
.nf
.ft C
@@ -734,6 +752,8 @@ sqlite3
ado_mssql
.ft P
.fi
+.UNINDENT
+.UNINDENT
.TP
.B name
The name of the database to use for statistics data. If
@@ -751,11 +771,25 @@ Host for database connections. Not used for sqlite3.
.TP
.B port
Port for database connections. Not used for sqlite3.
+.UNINDENT
+.UNINDENT
+.UNINDENT
+.SH REPORTING OPTIONS
+.INDENT 0.0
+.INDENT 3.5
+.INDENT 0.0
+.TP
+.B config
+Specifies the location of the reporting configuration (default
+is /etc/bcfg2\-web.conf.
.TP
.B time_zone
-Specify a time zone other than that used on the system. (Note
+Specifies a time zone other than that used on the system. (Note
that this will cause the Bcfg2 server to log messages in this
time zone as well).
+.TP
+.B web_debug
+Turn on Django debugging.
.UNINDENT
.UNINDENT
.UNINDENT
@@ -763,5 +797,4 @@ time zone as well).
.sp
\fIbcfg2(1)\fP, \fIbcfg2\-server(8)\fP
.\" Generated by docutils manpage writer.
-.\"
.
diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/base.py b/src/lib/Bcfg2/Client/Tools/POSIX/base.py
index b867fa3d8..f46875743 100644
--- a/src/lib/Bcfg2/Client/Tools/POSIX/base.py
+++ b/src/lib/Bcfg2/Client/Tools/POSIX/base.py
@@ -687,7 +687,7 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
if path is None:
path = entry.get("name")
cur = path
- while cur != '/':
+ while cur and cur != '/':
if not os.path.exists(cur):
created.append(cur)
cur = os.path.dirname(cur)
diff --git a/src/lib/Bcfg2/Compat.py b/src/lib/Bcfg2/Compat.py
index beb534791..57f96274f 100644
--- a/src/lib/Bcfg2/Compat.py
+++ b/src/lib/Bcfg2/Compat.py
@@ -19,12 +19,13 @@ except ImportError:
# urllib imports
try:
+ from urllib import quote_plus
from urlparse import urljoin, urlparse
from urllib2 import HTTPBasicAuthHandler, \
HTTPPasswordMgrWithDefaultRealm, build_opener, install_opener, \
urlopen, HTTPError, URLError
except ImportError:
- from urllib.parse import urljoin, urlparse
+ from urllib.parse import urljoin, urlparse, quote_plus
from urllib.request import HTTPBasicAuthHandler, \
HTTPPasswordMgrWithDefaultRealm, build_opener, install_opener, urlopen
from urllib.error import HTTPError, URLError
diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py
index fd096b75a..5f079f0b4 100644
--- a/src/lib/Bcfg2/Options.py
+++ b/src/lib/Bcfg2/Options.py
@@ -621,17 +621,19 @@ WEB_CFILE = \
default="/etc/bcfg2-web.conf",
cmd='-W',
odesc='<conffile>',
- cf=('statistics', 'config'),)
+ cf=('reporting', 'config'),
+ deprecated_cf=('statistics', 'web_prefix'),)
DJANGO_TIME_ZONE = \
Option('Django timezone',
default=None,
- cf=('statistics', 'time_zone'),)
+ cf=('reporting', 'time_zone'),
+ deprecated_cf=('statistics', 'web_prefix'),)
DJANGO_DEBUG = \
Option('Django debug',
default=None,
- cf=('statistics', 'web_debug'),
+ cf=('reporting', 'web_debug'),
+ deprecated_cf=('statistics', 'web_prefix'),
cook=get_bool,)
-# Django options
DJANGO_WEB_PREFIX = \
Option('Web prefix',
default=None,
diff --git a/src/lib/Bcfg2/Proxy.py b/src/lib/Bcfg2/Proxy.py
index 3b406c78e..224028b6a 100644
--- a/src/lib/Bcfg2/Proxy.py
+++ b/src/lib/Bcfg2/Proxy.py
@@ -1,6 +1,6 @@
-import logging
import re
import socket
+import logging
# The ssl module is provided by either Python 2.6 or a separate ssl
# package that works on older versions of Python (see
@@ -20,7 +20,7 @@ import sys
import time
# Compatibility imports
-from Bcfg2.Compat import httplib, xmlrpclib, urlparse
+from Bcfg2.Compat import httplib, xmlrpclib, urlparse, quote_plus
version = sys.version_info[:2]
has_py26 = version >= (2, 6)
@@ -349,7 +349,8 @@ def ComponentProxy(url, user=None, password=None, key=None, cert=None, ca=None,
if user and password:
method, path = urlparse(url)[:2]
- newurl = "%s://%s:%s@%s" % (method, user, password, path)
+ newurl = "%s://%s:%s@%s" % (method, quote_plus(user, ''),
+ quote_plus(password, ''), path)
else:
newurl = url
ssl_trans = XMLRPCTransport(key, cert, ca,
diff --git a/src/lib/Bcfg2/Reporting/templates/widgets/filter_bar.html b/src/lib/Bcfg2/Reporting/templates/widgets/filter_bar.html
index 759415507..bb4f650d1 100644
--- a/src/lib/Bcfg2/Reporting/templates/widgets/filter_bar.html
+++ b/src/lib/Bcfg2/Reporting/templates/widgets/filter_bar.html
@@ -16,7 +16,7 @@
<label for="id_group">Group filter:</label>
<select id="id_group" name="group" onchange="javascript:url=document.forms['filter_form'].group.value; if(url) { location.href=url }">
{% for group, group_url, selected in groups %}
- <option label="{{group}}" value="{{group_url}}" {% if selected %}selected {% endif %}/>
+ <option value="{{group_url}}" {% if selected %}selected {% endif %}>{{group}}</option>
{% endfor %}
</select>
{% endif %}
diff --git a/src/lib/Bcfg2/Server/Admin/Init.py b/src/lib/Bcfg2/Server/Admin/Init.py
index f2d6d7efa..3e642ee49 100644
--- a/src/lib/Bcfg2/Server/Admin/Init.py
+++ b/src/lib/Bcfg2/Server/Admin/Init.py
@@ -212,7 +212,7 @@ class Init(Bcfg2.Server.Admin.Mode):
"""Ask for the repository path."""
while True:
newrepo = safe_input("Location of Bcfg2 repository [%s]: " %
- self.data['repopath'])
+ self.data['repopath'])
if newrepo != '':
self.data['repopath'] = os.path.abspath(newrepo)
if os.path.isdir(self.data['repopath']):
@@ -318,6 +318,16 @@ class Init(Bcfg2.Server.Admin.Mode):
def init_repo(self):
"""Setup a new repo and create the content of the
configuration file."""
+ # Create the repository
+ path = os.path.join(self.data['repopath'], 'etc')
+ try:
+ os.makedirs(path)
+ self._init_plugins()
+ print("Repository created successfuly in %s" %
+ self.data['repopath'])
+ except OSError:
+ print("Failed to create %s." % path)
+
confdata = CONFIG % (self.data['repopath'],
','.join(self.plugins),
self.data['sendmail'],
@@ -333,13 +343,3 @@ class Init(Bcfg2.Server.Admin.Mode):
create_key(self.data['shostname'], self.data['keypath'],
self.data['certpath'], self.data['country'],
self.data['state'], self.data['location'])
-
- # Create the repository
- path = os.path.join(self.data['repopath'], 'etc')
- try:
- os.makedirs(path)
- self._init_plugins()
- print("Repository created successfuly in %s" %
- self.data['repopath'])
- except OSError:
- print("Failed to create %s." % path)
diff --git a/src/lib/Bcfg2/Server/models.py b/src/lib/Bcfg2/Server/models.py
index 0328c6bea..1f64111e7 100644
--- a/src/lib/Bcfg2/Server/models.py
+++ b/src/lib/Bcfg2/Server/models.py
@@ -1,6 +1,7 @@
""" Django database models for all plugins """
import sys
+import copy
import logging
import Bcfg2.Options
import Bcfg2.Server.Plugins
@@ -19,7 +20,7 @@ def load_models(plugins=None, cfile='/etc/bcfg2.conf', quiet=True):
# we want to provide a different default plugin list --
# namely, _all_ plugins, so that the database is guaranteed to
# work, even if /etc/bcfg2.conf isn't set up properly
- plugin_opt = Bcfg2.Options.SERVER_PLUGINS
+ plugin_opt = copy.deepcopy(Bcfg2.Options.SERVER_PLUGINS)
plugin_opt.default = Bcfg2.Server.Plugins.__all__
setup = \
diff --git a/src/sbin/bcfg2-test b/src/sbin/bcfg2-test
index 5b751af93..f62155850 100755
--- a/src/sbin/bcfg2-test
+++ b/src/sbin/bcfg2-test
@@ -64,7 +64,9 @@ class ClientTest(TestCase):
"Configuration is missing bundle(s): %s" % ':'.join(missing)
# check for unknown packages
- unknown_pkgs = config.xpath('//Package[@type="unknown"]')
+ unknown_pkgs = [el.get("name")
+ for el in config.xpath('//Package[@type="unknown"]')
+ if not self.ignore_entry(el.tag, el.get("name"))]
assert len(unknown_pkgs) == 0, \
"Configuration contains unknown packages: %s" % \
", ".join(unknown_pkgs)
diff --git a/tools/export.py b/tools/export.py
index 33c42d238..716c831d9 100755
--- a/tools/export.py
+++ b/tools/export.py
@@ -164,11 +164,17 @@ E.G. 1.2.0pre1 is a valid version.
print(help_message)
quit()
- rpmchangelog = ["* %s %s <%s> %s-0.0%s\n" %
- (datetime.datetime.now().strftime("%a %b %d %Y"),
- name, email,
- version_release, version_info['build']),
- "- New upstream release\n", "\n"]
+ if version_info['build'] == '':
+ rpmchangelog = ["* %s %s <%s> %s-1\n" %
+ (datetime.datetime.now().strftime("%a %b %d %Y"),
+ name, email, version_release),
+ "- New upstream release\n", "\n"]
+ else:
+ rpmchangelog = ["* %s %s <%s> %s-0.%s.%s\n" %
+ (datetime.datetime.now().strftime("%a %b %d %Y"),
+ name, email, version_release,
+ version_info['build'][-1], version_info['build']),
+ "- New upstream release\n", "\n"]
# write out the new RPM changelog
specs = ["misc/bcfg2.spec", "misc/bcfg2-selinux.spec", "redhat/bcfg2.spec.in"]
@@ -236,12 +242,22 @@ E.G. 1.2.0pre1 is a valid version.
find_and_replace('misc/bcfg2-selinux.spec', 'Version:',
'Version: %s\n' % version_release,
dryrun=options.dryrun)
- find_and_replace('misc/bcfg2.spec', 'Release: ',
- 'Release: 0.0%s\n' % version_info['build'],
- dryrun=options.dryrun)
- find_and_replace('misc/bcfg2-selinux.spec', 'Release: ',
- 'Release: 0.0%s\n' % version_info['build'],
- dryrun=options.dryrun)
+ if version_info['build'] == '':
+ find_and_replace('misc/bcfg2.spec', 'Release: ',
+ 'Release: 1\n',
+ dryrun=options.dryrun)
+ find_and_replace('misc/bcfg2-selinux.spec', 'Release: ',
+ 'Release: 1\n',
+ dryrun=options.dryrun)
+ else:
+ find_and_replace('misc/bcfg2.spec', 'Release: ',
+ 'Release: 0.%s.%s\n' %
+ (version_info['build'][-1], version_info['build']),
+ dryrun=options.dryrun)
+ find_and_replace('misc/bcfg2-selinux.spec', 'Release: ',
+ 'Release: 0.%s.%s\n' %
+ (version_info['build'][-1], version_info['build']),
+ dryrun=options.dryrun)
find_and_replace('misc/bcfg2.spec', '%setup',
'%%setup -q -n %%{name}-%%{version}%s\n' %
version_info['build'],
diff --git a/tools/upgrade/1.3/migrate_info.py b/tools/upgrade/1.3/migrate_info.py
index 5ff4b73b7..e72599daf 100755
--- a/tools/upgrade/1.3/migrate_info.py
+++ b/tools/upgrade/1.3/migrate_info.py
@@ -4,7 +4,8 @@ import os
import sys
import lxml.etree
import Bcfg2.Options
-from Bcfg2.Server.Plugin import info_regex
+from Bcfg2.Server.Plugin import INFO_REGEX
+
def convert(info_file):
info_xml = os.path.join(os.path.dirname(info_file), "info.xml")
@@ -15,7 +16,7 @@ def convert(info_file):
fileinfo = lxml.etree.Element("FileInfo")
info = lxml.etree.SubElement(fileinfo, "Info")
for line in open(info_file).readlines():
- match = info_regex.match(line)
+ match = INFO_REGEX.match(line)
if match:
mgd = match.groupdict()
for key, value in list(mgd.items()):
@@ -25,6 +26,7 @@ def convert(info_file):
open(info_xml, "w").write(lxml.etree.tostring(fileinfo, pretty_print=True))
os.unlink(info_file)
+
def main():
opts = dict(repo=Bcfg2.Options.SERVER_REPOSITORY,
configfile=Bcfg2.Options.CFILE,
diff --git a/tools/upgrade/1.3/migrate_perms_to_mode.py b/tools/upgrade/1.3/migrate_perms_to_mode.py
index 0aa9c574c..a15de6e29 100644..100755
--- a/tools/upgrade/1.3/migrate_perms_to_mode.py
+++ b/tools/upgrade/1.3/migrate_perms_to_mode.py
@@ -36,9 +36,7 @@ def convertstructure(structfile):
"""Do perms -> mode conversion for structure files."""
xdata = lxml.etree.parse(structfile)
found = False
- for path in xdata.findall('//BoundPath'):
- found = setmodeattr(path)
- for path in xdata.findall('//Path'):
+ for path in xdata.xpath('//BoundPath|Path'):
found = setmodeattr(path)
if found:
writefile(structfile, xdata)