summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/bcfg2-repo-validate.841
-rwxr-xr-xsrc/sbin/bcfg2-repo-validate9
2 files changed, 26 insertions, 24 deletions
diff --git a/man/bcfg2-repo-validate.8 b/man/bcfg2-repo-validate.8
index 0fb61e991..1bf74a206 100644
--- a/man/bcfg2-repo-validate.8
+++ b/man/bcfg2-repo-validate.8
@@ -8,28 +8,28 @@ bcfg2-repo-validate \- Check Bcfg2 repository data against data schemas
.PP
.B bcfg2-repo-validate
This script checks data against schemas, and it quite helpful in
-finding typos or malformed data.
+finding typos or malformed data.
.SH OPTIONS
-.PP
-.B "\-v"
-.RS
+
+.TP
+.BR "-v"
Be verbose about checks that have succeeded. This also enables
checking for missing bundles.
-.RE
-.B "\-C"
-.RS
+
+.TP
+.BR "-C"
Specify path to bcfg2.conf (default /etc/bcfg2.conf)
-.RE
-.B "\-Q"
-.RS
+
+.TP
+.BR "-Q"
Specify path to Bcfg2 repository (default /var/lib/bcfg2)
-.RE
-.B "\--schema"
-.RS
+
+.TP
+.BR "--schema"
Specify path to Bcfg2 XML Schemas (default /usr/share/bcfg2/schema)
-.RE
-.B "\--stdin"
-.RS
+
+.TP
+.BR "--stdin"
Rather than validating all XML files in the Bcfg2 specification, only
validate a list of files supplied on stdin. This makes a few
assumptions:
@@ -39,11 +39,12 @@ included on stdin; XIncludes will not be followed.
Property files will only be validated if both the property file itself
and its matching schema are included on stdin.
-.RE
-.B "\--require-schema"
-.RS
+
+.TP
+.BR "--require-schema"
Require property files to have matching schema files
-.RE
+
+.RE
.SH "SEE ALSO"
.BR bcfg2(1),
.BR bcfg2-server(8)
diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate
index ee79e218a..4d8dd6bed 100755
--- a/src/sbin/bcfg2-repo-validate
+++ b/src/sbin/bcfg2-repo-validate
@@ -6,6 +6,7 @@ repos against their respective XML schemas.
"""
__revision__ = '$Revision$'
+import fnmatch
import glob
import lxml.etree
import os
@@ -59,9 +60,9 @@ if __name__ == '__main__':
opts = {'repo': Bcfg2.Options.SERVER_REPOSITORY,
'verbose': Bcfg2.Options.VERBOSE,
'configfile': Bcfg2.Options.CFILE,
- 'schema' : Bcfg2.Options.SCHEMA_PATH,
- 'stdin': Bcfg2.Options.FILES_ON_STDIN,
'require-schema': Bcfg2.Options.REQUIRE_SCHEMA}
+ 'schema': Bcfg2.Options.SCHEMA_PATH,
+ 'stdin': Bcfg2.Options.FILES_ON_STDIN}
setup = Bcfg2.Options.OptionParser(opts)
setup.parse(sys.argv[1:])
verbose = setup['verbose']
@@ -77,7 +78,7 @@ if __name__ == '__main__':
logging.basicConfig(level=level, format="%(message)s")
if setup['stdin']:
- file_list = map(lambda s: s.strip(), sys.stdin.readlines())
+ file_list = [s.strip() for s in sys.stdin.readlines()]
info_list = [f for f in file_list if os.path.basename(f) == 'info.xml']
metadata_list = fnmatch.filter(file_list, "*/Metadata/*.xml")
clients_list = fnmatch.filter(file_list, "*/Metadata/clients.xml")
@@ -98,7 +99,7 @@ if __name__ == '__main__':
if "%s.xsd" % os.path.splitext(f)[0] in file_list]
else:
# not reading files from stdin
-
+
# Get a list of all info.xml files in the bcfg2 repository
info_list = []
for infodir in ['Cfg', 'TGenshi', 'TCheetah']: