.. -*- mode: rst -*-
.. vim: ft=rst

bcfg2-lint
==========

.. program:: bcfg2-lint

Synopsis
--------

**bcfg2-lint** [*options*] [*plugin* [*plugin*...]]

Description
-----------

:program:`bcfg2-lint` checks the Bcfg2 specification for schema
validity, common mistakes, and other criteria. It can be quite helpful
in finding typos or malformed data.

:program:`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.

:program:`bcfg2-lint` is a rewrite of the older bcfg2-repo-validate
tool.

Options
-------

-C configfile     Specify alternate bcfg2.conf location.
-Q path           Specify the path to the server repository.
-v                Be verbose.
--lint-config     Specify path to bcfg2-lint.conf (default
                  ``/etc/bcfg2-lint.conf``).
--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.

Plugins
-------

In addition to the plugins listed below, Bcfg2 server plugins may have
their own *bcfg2-lint* functionality, which is enabled automatically
when the server plugin is enabled.  See :manpage:`bcfg2-lint.conf(5)`
for more information on lint plugin configuration.

Comments
    Check the specification for VCS keywords and any comments that are
    required. By default, this only checks that the *$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.

Genshi
    Ensure that all Genshi templates are valid and compile properly.

GroupNames
    Ensure that all groups called by name in Metadata, Rules, Bundler,
    GroupPatterns, and Cfg are valid.

InfoXML
    Check that certain attributes are specified in *info.xml* files. By
    default, requires that *owner*, *group*, and *mode* are specified.
    Can also require that an *info.xml* exists for all Cfg files, and
    that paranoid mode be enabled for all files.

MergeFiles
    Suggest that similar probes and config files be merged into single
    probes or TGenshi templates.

RequiredAttrs
    Check that all entries have the appropriate required attributes,
    and that the attributes are in a valid format.  This goes above
    and beyond the validation offered by an XML schema.

Validate
    Validate the Bcfg2 specification against the XML schemas.

    Property files are freeform XML, but if a *.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 *ntp.xml* then by placing a schema for that file
    in *ntp.xsd* schema validation will be performed on *ntp.xml*.


Bugs
----

:program:`bcfg2-lint` may not handle some deprecated 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.

See Also
--------

:manpage:`bcfg2(1)`, :manpage:`bcfg2-server(8)`,
:manpage:`bcfg2-lint.conf(5)`
