diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-05-17 15:07:45 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-05-17 15:07:45 -0400 |
commit | b7e2699f5156607258ed0d500c5d6d6b92c35f26 (patch) | |
tree | 24bde5be78c5d9920d21b3f79de06474ff3d282f /src/lib/Bcfg2/Server/Lint/RequiredAttrs.py | |
parent | 044213c789c4f1ee214da3d70f02352b1aaa8673 (diff) | |
parent | 7e93fe741c17203fa63f60a7d1f66bfcdfb90d03 (diff) | |
download | bcfg2-b7e2699f5156607258ed0d500c5d6d6b92c35f26.tar.gz bcfg2-b7e2699f5156607258ed0d500c5d6d6b92c35f26.tar.bz2 bcfg2-b7e2699f5156607258ed0d500c5d6d6b92c35f26.zip |
Merge branch 'maint'
Conflicts:
doc/appendix/guides/centos.txt
doc/server/plugins/grouping/metadata.txt
setup.py
src/lib/Bcfg2/Client/Frame.py
src/lib/Bcfg2/Client/Proxy.py
src/lib/Bcfg2/Server/Lint/Genshi.py
src/lib/Bcfg2/Server/Lint/Validate.py
src/lib/Bcfg2/Server/Plugins/Bundler.py
src/lib/Bcfg2/Server/Plugins/SSHbase.py
src/sbin/bcfg2-lint
Diffstat (limited to 'src/lib/Bcfg2/Server/Lint/RequiredAttrs.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/RequiredAttrs.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py b/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py index 7a2fd3fe9..f2464b585 100644 --- a/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py +++ b/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py @@ -1,5 +1,5 @@ -""" verify attributes for configuration entries that cannot be -verified with an XML schema alone""" +""" Verify attributes for configuration entries that cannot be +verified with an XML schema alone. """ import os import re @@ -14,7 +14,8 @@ except ImportError: HAS_GENSHI = False -# format verifying functions +# format verifying functions. TODO: These should be moved into XML +# schemas where possible. def is_filename(val): """ Return True if val is a string describing a valid full path """ @@ -52,8 +53,8 @@ def is_device_mode(val): class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): - """ verify attributes for configuration entries that cannot be - verified with an XML schema alone """ + """ Verify attributes for configuration entries that cannot be + verified with an XML schema alone. """ def __init__(self, *args, **kwargs): Bcfg2.Server.Lint.ServerPlugin.__init__(self, *args, **kwargs) self.required_attrs = dict( @@ -114,8 +115,7 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): SEInterface={None: dict(name=None, selinuxtype=is_selinux_type)}, SEPermissive={None: dict(name=is_selinux_type)}, POSIXGroup={None: dict(name=is_username)}, - POSIXUser={None: dict(name=is_username)}, - MemberOf={None: dict(__text__=is_username)}) + POSIXUser={None: dict(name=is_username)}) def Run(self): self.check_packages() @@ -135,7 +135,8 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): "extra-attrs": "warning"} def check_packages(self): - """ check package sources for Source entries with missing attrs """ + """ Check Packages sources for Source entries with missing + attributes. """ if 'Packages' not in self.core.plugins: return @@ -175,7 +176,8 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): rules.name)) def check_bundles(self): - """ check bundles for BoundPath entries with missing attrs """ + """ Check bundles for BoundPath entries with missing + attrs. """ if 'Bundler' not in self.core.plugins: return @@ -186,7 +188,13 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): self.check_entry(path, bundle.name) def check_entry(self, entry, filename): - """ generic entry check """ + """ Generic entry check. + + :param entry: The XML entry to check for missing attributes. + :type entry: lxml.etree._Element + :param filename: The filename the entry came from + :type filename: string + """ if self.HandlesFile(filename): name = entry.get('name') tag = entry.tag |