diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2011-04-21 08:50:06 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2011-04-21 08:50:06 -0400 |
commit | 6da7d24710fe67c80c4a71f227cd01675eebca88 (patch) | |
tree | f8aae1f09b879d58e8fab10db1b896284b44e32d | |
parent | 57f6972c4ff063a0fdeff832772af8c18f2ea044 (diff) | |
download | bcfg2-6da7d24710fe67c80c4a71f227cd01675eebca88.tar.gz bcfg2-6da7d24710fe67c80c4a71f227cd01675eebca88.tar.bz2 bcfg2-6da7d24710fe67c80c4a71f227cd01675eebca88.zip |
Lots of cleanup for bcfg2-repo-validate rewrite:
* Changed all references to bcfg2-repo-validate in the documentation
to bcfg2-lint
* Wrote man pages for bcfg2-lint and bcfg2-lint.conf
* Cleaned up straggling references to bcfg2-repo-validate in
Makefiles, spec files, and the POSIX tool
* A few minor bug fixes
-rw-r--r-- | doc/appendix/guides/centos.txt | 2 | ||||
-rw-r--r-- | doc/appendix/guides/fedora.txt | 3 | ||||
-rw-r--r-- | doc/appendix/guides/import-existing-ssh-keys.txt | 2 | ||||
-rw-r--r-- | doc/appendix/guides/ubuntu.txt | 2 | ||||
-rw-r--r-- | doc/help/faq/general.txt | 6 | ||||
-rw-r--r-- | doc/help/troubleshooting.txt | 5 | ||||
-rw-r--r-- | doc/server/configurationentries.txt | 6 | ||||
-rw-r--r-- | doc/server/plugins/connectors/properties.txt | 2 | ||||
-rw-r--r-- | doc/server/plugins/generators/packages.txt | 2 | ||||
-rw-r--r-- | doc/server/plugins/grouping/metadata.txt | 6 | ||||
-rw-r--r-- | examples/bcfg2-lint.conf | 5 | ||||
-rw-r--r-- | man/bcfg2-lint.8 | 169 | ||||
-rw-r--r-- | man/bcfg2-lint.conf.5 | 155 | ||||
-rw-r--r-- | man/bcfg2-repo-validate.8 | 52 | ||||
-rw-r--r-- | man/bcfg2-server.8 | 2 | ||||
-rw-r--r-- | misc/bcfg2.spec | 2 | ||||
-rw-r--r-- | osx/Makefile | 2 | ||||
-rw-r--r-- | redhat/bcfg2.spec.in | 2 | ||||
-rw-r--r-- | src/lib/Client/Tools/POSIX.py | 22 | ||||
-rw-r--r-- | src/lib/Server/Lint/InfoXML.py | 12 | ||||
-rwxr-xr-x | src/sbin/bcfg2-lint | 11 |
21 files changed, 371 insertions, 99 deletions
diff --git a/doc/appendix/guides/centos.txt b/doc/appendix/guides/centos.txt index 119c3d2f8..dae11e5d4 100644 --- a/doc/appendix/guides/centos.txt +++ b/doc/appendix/guides/centos.txt @@ -244,7 +244,7 @@ file should look something like this .. note:: When editing your xml files by hand, it is useful to occasionally run - `bcfg2-repo-validate` to ensure that your xml validates properly. + `bcfg2-lint` to ensure that your xml validates properly. The final thing we need is for the client to have the proper arch group membership. For this, we will make use of the diff --git a/doc/appendix/guides/fedora.txt b/doc/appendix/guides/fedora.txt index e8c1af7b6..db23e94bf 100644 --- a/doc/appendix/guides/fedora.txt +++ b/doc/appendix/guides/fedora.txt @@ -249,8 +249,7 @@ file should look something like this .. note:: When editing your xml files by hand, it is useful to occasionally - run ``bcfg2-repo-validate`` to ensure that your xml validates - properly. + run ``bcfg2-lint`` to ensure that your xml validates properly. Add a probe +++++++++++ diff --git a/doc/appendix/guides/import-existing-ssh-keys.txt b/doc/appendix/guides/import-existing-ssh-keys.txt index e606ba908..64a1b62cd 100644 --- a/doc/appendix/guides/import-existing-ssh-keys.txt +++ b/doc/appendix/guides/import-existing-ssh-keys.txt @@ -46,7 +46,7 @@ Validate your repository Validation can be performed using the following command:: - bcfg2-repo-validate -v + bcfg2-lint Run the bcfg2 client ==================== diff --git a/doc/appendix/guides/ubuntu.txt b/doc/appendix/guides/ubuntu.txt index 56480796d..ff87e7d97 100644 --- a/doc/appendix/guides/ubuntu.txt +++ b/doc/appendix/guides/ubuntu.txt @@ -202,7 +202,7 @@ something like this .. note:: When editing your xml files by hand, it is useful to occasionally run - `bcfg2-repo-validate` to ensure that your xml validates properly. + `bcfg2-lint` to ensure that your xml validates properly. The last thing we need is for the client to have the proper arch group membership. For this, we will make use of the diff --git a/doc/help/faq/general.txt b/doc/help/faq/general.txt index f8ecc9854..ae53ca399 100644 --- a/doc/help/faq/general.txt +++ b/doc/help/faq/general.txt @@ -51,6 +51,6 @@ The bcfg2-server process logs to syslog facility LOG_DAEMON. The server produces **Is there a way to check if all repository XML files conform to schemas?** Bcfg2 comes with XML schemas describing all of the XML formats used in -the server repository. A validation command ``bcfg2-repo-validate`` is -included with the source distribution and all packages. Run it with -the ``-v`` flag to see each file and the results if its validation. +the server repository. A validation command ``bcfg2-lint`` is +included with the source distribution and all packages. ``bcfg2-lint`` +can also performs lots of other checks for common mistakes. diff --git a/doc/help/troubleshooting.txt b/doc/help/troubleshooting.txt index e593db2f7..033b60706 100644 --- a/doc/help/troubleshooting.txt +++ b/doc/help/troubleshooting.txt @@ -38,9 +38,8 @@ Check if all repository XML files conform to schemas ==================================================== Bcfg2 comes with XML schemas describing all of the XML formats used in -the server repository. A validation command ``bcfg2-repo-validate`` is -included with the source distribution and all packages. Run it with the --v flag to see each file and the results if its validation. +the server repository. A validation command ``bcfg2-lint`` is +included with the source distribution and all packages. If the bcfg2 server is not reflecting recent changes, try restarting the bcfg2-server process ============================================================================================= diff --git a/doc/server/configurationentries.txt b/doc/server/configurationentries.txt index 4ade2d414..1d278fa0a 100644 --- a/doc/server/configurationentries.txt +++ b/doc/server/configurationentries.txt @@ -50,9 +50,9 @@ plugin that handles the entry in the case of `Cfg`_, `TGenshi`_, or a device, directory, hardlink, symlink, etc), then you will specify both the *type* and any other necessary attributes in `Rules`_. -Running ``bcfg2-repo-validate`` will check your configuration -specification for the presence of any mandatory attributes that are -necessary for the Path type specified. +Running ``bcfg2-lint`` will check your configuration specification for +the presence of any mandatory attributes that are necessary for the +Path type specified. .. note:: A tool for converting old POSIX entries is available in the Bcfg2 source directory at tools/posixunified.py diff --git a/doc/server/plugins/connectors/properties.txt b/doc/server/plugins/connectors/properties.txt index e82cfc570..1cbc4cf65 100644 --- a/doc/server/plugins/connectors/properties.txt +++ b/doc/server/plugins/connectors/properties.txt @@ -26,7 +26,7 @@ contain parsed XML data as the "data" attribute. The XML data in a property file is arbitrary, but a matching ``.xsd`` file can be created to assign a schema to a property file, which will -be checked when running ``bcfg2-repo-validate``. For instance, given:: +be checked when running ``bcfg2-lint``. For instance, given:: Properties/dns-config.xml Properties/dns-config.xsd diff --git a/doc/server/plugins/generators/packages.txt b/doc/server/plugins/generators/packages.txt index f001f157e..90cd19de4 100644 --- a/doc/server/plugins/generators/packages.txt +++ b/doc/server/plugins/generators/packages.txt @@ -273,7 +273,7 @@ Validation ========== A schema for Packages/config.xml is included; config.xml can be validated -using ``bcfg2-repo-validate``. +using ``bcfg2-lint``. .. note:: The schema requires that elements be specified in the above order. diff --git a/doc/server/plugins/grouping/metadata.txt b/doc/server/plugins/grouping/metadata.txt index 1c915e2cf..43cc6a2d7 100644 --- a/doc/server/plugins/grouping/metadata.txt +++ b/doc/server/plugins/grouping/metadata.txt @@ -217,9 +217,9 @@ useful results: </Groups> Each of the included groups files has the same format. These files are -properly validated by ``bcfg2-repo-validate``. This mechanism is -useful for composing group definitions from multiple sources, or -setting different permissions in an svn repository. +properly validated by ``bcfg2-lint``. This mechanism is useful for +composing group definitions from multiple sources, or setting +different permissions in an svn repository. Probes ====== diff --git a/examples/bcfg2-lint.conf b/examples/bcfg2-lint.conf index 5c7641d4a..1d3a82160 100644 --- a/examples/bcfg2-lint.conf +++ b/examples/bcfg2-lint.conf @@ -2,7 +2,7 @@ plugins=Duplicates,InfoXML,Bundles,Headers,RequiredAttrs,Validate [InfoXML] -require = owner,group,perms,paranoid +required_attrs = owner,group,perms,paranoid require_paranoid = True [Comments] @@ -15,6 +15,5 @@ cfg_keywords = probe_comments = Maintainer,Purpose,Groups,Other Output [Validate] -schema=/home/stpierre/devel/bcfg2/schema -repo=/home/stpierre/bcfg2/trunk +schema=/usr/share/bcfg2/schema properties_schema=warn diff --git a/man/bcfg2-lint.8 b/man/bcfg2-lint.8 new file mode 100644 index 000000000..624082960 --- /dev/null +++ b/man/bcfg2-lint.8 @@ -0,0 +1,169 @@ +.TH "bcfg2-lint" 8 +.SH NAME +bcfg2-lint \- Check Bcfg2 specification for validity, common mistakes, +and style + +.SH SYNOPSIS +.B bcfg2-lint +.I [OPTIONS] +.I [<plugin> [<plugin>...]] + +.SH DESCRIPTION +.PP +.B bcfg2-lint +This script checks the Bcfg2 specification for schema validity, common +mistakes, and other criteria. It can be quite helpful in finding +typos or malformed data. + +.B bcfg2-lint +exits with a return value of 2 if errors were found, and 3 +if warnings (but no errors) were found. Any other non-0 exit value +denotes some failure in the script itself. + +.B bcfg2-lint +is a rewrite of the older +.B bcfg2-repo-validate +tool. + +.SH OPTIONS + +.TP +.BR "-v" +Be verbose. + +.TP +.BR "-C" +Specify path to bcfg2.conf (default /etc/bcfg2.conf) + +.TP +.BR "--lint-config" +Specify path to bcfg2-lint.conf (default /etc/bcfg2-lint.conf) + +.TP +.BR "-Q" +Specify path to Bcfg2 repository (default /var/lib/bcfg2) + +.TP +.BR "--stdin" +Rather than operating on all files in the Bcfg2 specification, only +validate a list of files supplied on stdin. This mode is particularly +useful in pre-commit hooks. + +This makes a few assumptions: + +Metadata files will only be checked if a valid chain of XIncludes can +be followed all the way from clients.xml or groups.xml. Since there +are multiple formats of metadata stored in Metadata/ (i.e., clients +and groups), there is no way to determine which sort of data a file +contains unless there is a valid chain of XIncludes. It may be useful +to always specify all metadata files should be checked, even if not +all of them have changed. + +Property files will only be validated if both the property file itself +and its matching schema are included on stdin. + +.TP +.BR "--require-schema" +Require property files to have matching schema files + +.RE + +.SH "PLUGINS" + +See +.BR bcfg-lint.conf(5) +for more information on the configuration of the plugins listed below. + +.TP +.BR Bundles +Check the specification for several issues with Bundler: bundles +referenced in metadata but not found in +.I Bundler/ +; bundles whose +.I name +attribute does not match the filename; and Genshi template bundles +that use the +.I <Group> +tag (which is not processed in templated bundles). + +.TP +.BR Comments +Check the specification for VCS keywords and any comments that are +required. By default, this only checks that the +.I $Id$ +keyword is included and expanded in all files. You may specify VCS +keywords to check and comments to be required in the config file. +(For instance, you might require that every file have a "Maintainer" +comment.) + +In XML files, only comments are checked for the keywords and comments +required. + +.TP +.BR Duplicates +Check for several types of duplicatesin the Metadata: duplicate +groups; duplicate clients; and multiple default groups. + +.TP +.BR InfoXML +Check that certain attributes are specified in +.I info.xml +files. By default, requires that +.I owner +, +.I group +, and +.I perms +are specified. Can also require that an +.I info.xml +exists for all Cfg files, and that paranoid mode be enabled for all +files. + +.TP +.BR Pkgmgr +Check for duplicate packages specified in Pkgmgr. + +.TP +.BR RequiredAttrs +Check that all +.I <Path> +and +.I <BoundPath> +tags have the attributes that are required by their type. (E.g., a +path of type +.I "symlink" +must have +.I name +and +.I to +specified to be valid. This sort of validation is beyond the scope of +an XML schema. + +.TP +.BR Validate +Validate the Bcfg2 specification against the XML schemas. + +Property files are freeform XML, but if a +.I .xsd +file with a matching filename is provided, then schema validation will +be performed on property files individually as well. For instance, if +you have a property file named +.I ntp.xml +then by placing a schema for that file in +.I ntp.xsd +schema validation will be performed on +.I ntp.xml +. + + +.SH "SEE ALSO" +.BR bcfg2(1), +.BR bcfg2-server(8), +.BR bcfg2-lint.conf(5) + +.SH "BUGS" + +bcfg2-lint may not handle some older plugins as well as it handles +newer ones. For instance, there may be some places where it expects +all of your configuration files to be handled by Cfg rather than by a +mix of Cfg and TGenshi or TCheetah. diff --git a/man/bcfg2-lint.conf.5 b/man/bcfg2-lint.conf.5 new file mode 100644 index 000000000..2c89a1161 --- /dev/null +++ b/man/bcfg2-lint.conf.5 @@ -0,0 +1,155 @@ +.TH bcfg2-lint.conf 5 + +.SH NAME +bcfg2-lint.conf - configuration parameters for bcfg2-lint + +.SH DESCRIPTION +.TP +bcfg2-lint.conf includes configuration parameters for +.I bcfg2-lint + +.SH FILE FORMAT +The file is INI-style and consists of sections and options. A section +begins with the name of the sections in square brackets and continues +until the next section begins. + +Options are specified in the form 'name = value'. + +The file is line-based each newline-terminated line represents either +a comment, a section name or an option. + +Any line beginning with a hash (#) is ignored, as are lines containing +only whitespace. + +.SH GLOBAL OPTIONS +These options apply to +.I bcfg2-lint +generally, and must be in the +.I [main] +section. + +.TP +.BR plugins +A comma-delimited list of plugins to run. By default, all plugins are +run. This can be overridden by listing plugins on the command line. +See +.B bcfg2-lint(1) +for a list of the available plugins. + +.SH PLUGIN OPTIONS + +These options apply only to a single plugin. Each option should be in +a section named for its plugin; for instance, options for the InfoXML +plugin would be in a section called +.I [InfoXML] +. + +If a plugin is not listed below, then it has no configuration. + +.TP +.BR Comments + +The +.I Comments +plugin configuration specifies which VCS keywords and comments are +required for which file types. The valid types of file are +.I "global" +(all file types), +.I "bundler" +(non-templated bundle files), +.I "sgenshi" +(templated bundle files), +.I "properties" +(property files), +.I "cfg" +(non-templated Cfg files), +.I "tgenshi" +(templated Cfg files), +.I "infoxml" +(info.xml files), and +.I "probe" +(probe files). + +The specific types (i.e., types other than "global") all supplement +global; they do not override it. The exception is if you specify an +empty option, e.g.: + +.nf +cfg_keywords = +.fi + +By default, the +.I $Id$ +keyword is checked for and nothing else. + +Multiple keywords or comments should be comma-delimited. + +\(bu +.B <type>_keywords + +Ensure that files of the specified type have the given VCS keyword. +Do +.I not +include the dollar signs. I.e.: + +.nf +infoxml_keywords = Revision +.fi + +.I not: + +.nf +infoxml_keywords = $Revision$ +.fi + +\(bu +.B <type>_comments + +Ensure that files of the specified type have a comment containing the +given string. In XML files, only comments are checked. In plain text +files, all lines are checked since comment characters may vary. + +.TP +.BR InfoXML + +\(bu +.B required_attrs +A comma-delimited list of attributes to require on +.I <Info> +tags. Default is "owner,group,perms". + +\(bu +.B require_paranoid +Ensure that paranoid mode is on for all files. This can be +accomplished by either setting the global paranoid value (and not +overriding it. Default is false. + +\(bu +.B require +Require an +.I info.xml +file for all Cfg files. Default is false. + +.TP +.BR Validate + +\(bu +.B schema +The full path to the XML Schema files. Default is +"/usr/share/bcfg2/schema". This can be overridden with the +.I --schema +command-line option + +\(bu +.B properties_schema +If set to +.I "warn" +, will warn if a property files does not have a matching schema file. +If set to +.I "require" +, will produce an error if a property files does not have a matching +schema file. Default is to neither warn nor require. + +.SH SEE ALSO +.BR bcfg2-lint(1) + diff --git a/man/bcfg2-repo-validate.8 b/man/bcfg2-repo-validate.8 deleted file mode 100644 index 1bf74a206..000000000 --- a/man/bcfg2-repo-validate.8 +++ /dev/null @@ -1,52 +0,0 @@ -.TH "bcfg2-repo-validate" 8 -.SH NAME -bcfg2-repo-validate \- Check Bcfg2 repository data against data schemas -.SH SYNOPSIS -.B bcfg2-repo-validate -.I [OPTIONS] -.SH DESCRIPTION -.PP -.B bcfg2-repo-validate -This script checks data against schemas, and it quite helpful in -finding typos or malformed data. -.SH OPTIONS - -.TP -.BR "-v" -Be verbose about checks that have succeeded. This also enables -checking for missing bundles. - -.TP -.BR "-C" -Specify path to bcfg2.conf (default /etc/bcfg2.conf) - -.TP -.BR "-Q" -Specify path to Bcfg2 repository (default /var/lib/bcfg2) - -.TP -.BR "--schema" -Specify path to Bcfg2 XML Schemas (default /usr/share/bcfg2/schema) - -.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: - -Files included using XInclude will only be validated if they are -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. - -.TP -.BR "--require-schema" -Require property files to have matching schema files - -.RE -.SH "SEE ALSO" -.BR bcfg2(1), -.BR bcfg2-server(8) -.SH "BUGS" -None currently known diff --git a/man/bcfg2-server.8 b/man/bcfg2-server.8 index a6bffc1fa..2d132ce6d 100644 --- a/man/bcfg2-server.8 +++ b/man/bcfg2-server.8 @@ -53,6 +53,6 @@ Set path to SSL key. .RE .SH "SEE ALSO" .BR bcfg2(1), -.BR bcfg2-repo-validate(8) +.BR bcfg2-lint(8) .SH "BUGS" None currently known diff --git a/misc/bcfg2.spec b/misc/bcfg2.spec index 377e62af2..27840fb5e 100644 --- a/misc/bcfg2.spec +++ b/misc/bcfg2.spec @@ -226,7 +226,7 @@ mv build/dtd %{buildroot}%{_defaultdocdir}/bcfg2-doc-%{version}/ %{_sbindir}/bcfg2-build-reports %{_sbindir}/bcfg2-info %{_sbindir}/bcfg2-ping-sweep -%{_sbindir}/bcfg2-repo-validate +%{_sbindir}/bcfg2-lint %{_sbindir}/bcfg2-reports %{_sbindir}/bcfg2-server diff --git a/osx/Makefile b/osx/Makefile index bd16a4227..82a2e967b 100644 --- a/osx/Makefile +++ b/osx/Makefile @@ -14,7 +14,7 @@ FILTERS = --filter Hostbase \ --filter bcfg2-build-reports \ --filter bcfg2-info \ --filter bcfg2-ping-sweep \ ---filter bcfg2-repo-validate \ +--filter bcfg2-lint \ --filter bcfg2-reports \ --filter bcfg2-server diff --git a/redhat/bcfg2.spec.in b/redhat/bcfg2.spec.in index 34558dc22..dc25ce522 100644 --- a/redhat/bcfg2.spec.in +++ b/redhat/bcfg2.spec.in @@ -234,7 +234,7 @@ fi %{_sbindir}/bcfg2-build-reports %{_sbindir}/bcfg2-info %{_sbindir}/bcfg2-ping-sweep -%{_sbindir}/bcfg2-repo-validate +%{_sbindir}/bcfg2-lint %{_sbindir}/bcfg2-reports %{_sbindir}/bcfg2-server diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py index bcb9f48b3..af3d1a473 100644 --- a/src/lib/Client/Tools/POSIX.py +++ b/src/lib/Client/Tools/POSIX.py @@ -137,14 +137,14 @@ class POSIX(Bcfg2.Client.Tools.Tool): entry.get('owner') == None or \ entry.get('group') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % (entry.get('name'))) + 'Try running bcfg2-lint.' % (entry.get('name'))) return False if entry.get('dev_type') in ['block', 'char']: # check if major/minor are properly specified if entry.get('major') == None or \ entry.get('minor') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % (entry.get('name'))) + 'Try running bcfg2-lint.' % (entry.get('name'))) return False try: # check for file existence @@ -167,7 +167,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): if entry.get('major') == None or \ entry.get('minor') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % (entry.get('name'))) + 'Try running bcfg2-lint.' % (entry.get('name'))) return False major = int(entry.get('major')) minor = int(entry.get('minor')) @@ -218,7 +218,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): if entry.get('major') == None or \ entry.get('minor') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % (entry.get('name'))) + 'Try running bcfg2-lint.' % (entry.get('name'))) return False major = int(entry.get('major')) minor = int(entry.get('minor')) @@ -240,7 +240,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): entry.get('owner') == None or \ entry.get('group') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % (entry.get('name'))) + 'Try running bcfg2-lint.' % (entry.get('name'))) return False while len(entry.get('perms', '')) < 4: entry.set('perms', '0' + entry.get('perms', '')) @@ -348,7 +348,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): entry.get('owner') == None or \ entry.get('group') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % \ + 'Try running bcfg2-lint.' % \ (entry.get('name'))) return False self.logger.info("Installing directory %s" % (entry.get('name'))) @@ -614,7 +614,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): """Verify HardLink entry.""" if entry.get('to') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % \ + 'Try running bcfg2-lint.' % \ (entry.get('name'))) return False try: @@ -637,7 +637,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): """Install HardLink entry.""" if entry.get('to') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % \ + 'Try running bcfg2-lint.' % \ (entry.get('name'))) return False self.logger.info("Installing Hardlink %s" % (entry.get('name'))) @@ -713,7 +713,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): entry.get('owner') == None or \ entry.get('group') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % (entry.get('name'))) + 'Try running bcfg2-lint.' % (entry.get('name'))) return False try: os.chown(entry.get('name'), normUid(entry), normGid(entry)) @@ -728,7 +728,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): """Verify Path type='symlink' entry.""" if entry.get('to') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % \ + 'Try running bcfg2-lint.' % \ (entry.get('name'))) return False try: @@ -751,7 +751,7 @@ class POSIX(Bcfg2.Client.Tools.Tool): """Install Path type='symlink' entry.""" if entry.get('to') == None: self.logger.error('Entry %s not completely specified. ' - 'Try running bcfg2-repo-validate.' % \ + 'Try running bcfg2-lint.' % \ (entry.get('name'))) return False self.logger.info("Installing symlink %s" % (entry.get('name'))) diff --git a/src/lib/Server/Lint/InfoXML.py b/src/lib/Server/Lint/InfoXML.py index 097c2d6f9..42679109a 100644 --- a/src/lib/Server/Lint/InfoXML.py +++ b/src/lib/Server/Lint/InfoXML.py @@ -15,8 +15,8 @@ class InfoXML(Bcfg2.Server.Lint.ServerPlugin): xdata = entryset.infoxml.pnode.data for info in xdata.getroottree().findall("//Info"): required = ["owner", "group", "perms"] - if "required" in self.config: - required = self.config["required"].split(",") + if "required_attrs" in self.config: + required = self.config["required_attrs"].split(",") missing = [attr for attr in required if info.get(attr) is None] @@ -27,8 +27,12 @@ class InfoXML(Bcfg2.Server.Lint.ServerPlugin): if ("require_paranoid" in self.config and self.config["require_paranoid"].lower() == "true" and - not Bcfg2.Options.MDATA_PARANOID.value and - info.get("paranoid").lower() != "true"): + (Bcfg2.Options.MDATA_PARANOID.value and + info.get("paranoid") is not None and + info.get("paranoid").lower() == "false") or + (not Bcfg2.Options.MDATA_PARANOID.value and + (info.get("paranoid") is None or + info.get("paranoid").lower() != "true"))): self.LintError("Paranoid must be true in %s:%s" % (infoxml_fname, self.RenderXML(info))) diff --git a/src/sbin/bcfg2-lint b/src/sbin/bcfg2-lint index 42c077d63..91869617f 100755 --- a/src/sbin/bcfg2-lint +++ b/src/sbin/bcfg2-lint @@ -58,12 +58,11 @@ def run_plugin(plugin, plugin_name, setup=None, args=None, config=None, else: args.append(setup) - return plugin(*args, files=files).Run() - # try: - # return plugin(*args, files=files).Run() - # except Exception, err: - # logger.error("Failed to run plugin %s: %s" % (plugin, err)) - # raise SystemExit(1) + try: + return plugin(*args, files=files).Run() + except Exception, err: + logger.error("Failed to run plugin %s: %s" % (plugin, err)) + raise SystemExit(1) def load_server(setup): """ load server """ |