.. -*- mode: rst -*- .. _development-client-driver: ============================== Writing A Client Tool Driver ============================== This page describes the step-by-step process of writing a client tool driver for a configuration element type. The included example describes an existing driver, and the process that was used to create it. #. Pick a name for the driver. In this case, we picked the name RPM. #. Create a file in ``src/lib/Bcfg2/Client/Tools`` with the same name (RPM.py) #. Create a class in this file with the same name (``class RPM``) * If it handles **Package** entries, subclass :class:`Bcfg2.Client.Tools.PkgTool` * If it handles **Service** entries, subclass :class:`Bcfg2.Client.Tools.SvcTool` * Otherwise, subclass :class:`Bcfg2.Client.Tools.Tool`. #. Add any required executable programs to :attr:`Bcfg2.Client.Tools.Tool.__execs__` #. Set :attr:`Bcfg2.Client.Tools.Tool.__handles__` to a list of ``(, )`` tuples. This determines which entries the Tool module can be used on. In this case, we set ``__handles__ = [('Package', 'rpm')]``. #. Add verification support by defining a method named ``Verify``. See :func:`Bcfg2.Client.Tools.Tool.Inventory` for details. This method should return True/False depending on current entry installation status. In the failure path, the current state of failing entry attributes should be set in the entry, to aid in auditing. (For example, if a file should be mode 644, and is currently mode 600, then set attribute current_mode='600' in the input entry) #. Add installation support by defining a method named ``Install