From 6a4569e4d0e59fea1e60d8ddb8805792dbecb080 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 17 Sep 2012 10:25:56 -0400 Subject: better SEModules docs --- src/lib/Bcfg2/Server/Plugins/SEModules.py | 34 ++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/lib/Bcfg2/Server/Plugins') diff --git a/src/lib/Bcfg2/Server/Plugins/SEModules.py b/src/lib/Bcfg2/Server/Plugins/SEModules.py index 8a70434e8..b04e2d359 100644 --- a/src/lib/Bcfg2/Server/Plugins/SEModules.py +++ b/src/lib/Bcfg2/Server/Plugins/SEModules.py @@ -1,3 +1,14 @@ +""" +The SEModules plugin handles SELinux module entries. It supports +group- and host-specific module versions, and enabling/disabling +modules. + +You can use ``tools/selinux_baseline.py`` to create a baseline of all +of your installed modules. + +See :ref:`server-selinux` for more information. +""" + import os import logging import Bcfg2.Server.Plugin @@ -7,17 +18,35 @@ logger = logging.getLogger(__name__) class SEModuleData(Bcfg2.Server.Plugin.SpecificData): + """ Representation of a single SELinux module file. Encodes the + data using base64 automatically """ + def bind_entry(self, entry, _): + """ Return a fully-bound entry. The module data is + automatically encoded with base64. + + :param entry: The abstract entry to bind the module for + :type entry: lxml.etree._Element + :returns: lxml.etree._Element - the fully bound entry + """ entry.set('encoding', 'base64') entry.text = b64encode(self.data) + return entry class SEModules(Bcfg2.Server.Plugin.GroupSpool): """ Handle SELinux 'module' entries """ - name = 'SEModules' __author__ = 'chris.a.st.pierre@gmail.com' + + #: SEModules is a :class:`Bcfg2.Server.Plugin.helpers.GroupSpool` + #: that uses :class:`Bcfg2.Server.Plugins.SEModules.SEModuleData` + #: objects as its EntrySet children. es_child_cls = SEModuleData + + #: SEModules manages ``SELinux`` entries entry_type = 'SELinux' + + #: The SEModules plugin is experimental experimental = True def _get_module_filename(self, entry): @@ -46,13 +75,16 @@ class SEModules(Bcfg2.Server.Plugin.GroupSpool): return self._get_module_filename(entry) in self.Entries[entry.tag] return Bcfg2.Server.Plugin.GroupSpool.HandlesEntry(self, entry, metadata) + HandlesEntry.__doc__ = Bcfg2.Server.Plugin.GroupSpool.HandlesEntry.__doc__ def HandleEntry(self, entry, metadata): entry.set("name", self._get_module_name(entry)) bind = self.Entries[entry.tag][self._get_module_filename(entry)] return bind(entry, metadata) + HandleEntry.__doc__ = Bcfg2.Server.Plugin.GroupSpool.HandleEntry.__doc__ def add_entry(self, event): self.filename_pattern = \ os.path.basename(os.path.dirname(self.event_path(event))) Bcfg2.Server.Plugin.GroupSpool.add_entry(self, event) + add_entry.__doc__ = Bcfg2.Server.Plugin.GroupSpool.add_entry.__doc__ -- cgit v1.2.3-1-g7c22