summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2010-06-07 14:51:44 -0500
committerSol Jerome <solj@ices.utexas.edu>2010-06-07 14:51:44 -0500
commit2a7947f29bf9d530ff42e86c4a811bf4a6f64088 (patch)
treebe878a32b197537f9af6bea5cf8ece74d04b8b3b /src/sbin
parenta494733c745b556ff5cf0e1cea1e48c6ee403556 (diff)
downloadbcfg2-2a7947f29bf9d530ff42e86c4a811bf4a6f64088.tar.gz
bcfg2-2a7947f29bf9d530ff42e86c4a811bf4a6f64088.tar.bz2
bcfg2-2a7947f29bf9d530ff42e86c4a811bf4a6f64088.zip
repo-validate: Warn when missing attributes for Path entries
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg2-repo-validate33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate
index 1bdcf4180..8675b9ac1 100755
--- a/src/sbin/bcfg2-repo-validate
+++ b/src/sbin/bcfg2-repo-validate
@@ -84,6 +84,39 @@ if __name__ == '__main__':
pkgcfg_list = glob.glob("%s/Packages/config.xml" % repo)
gp_list = glob.glob('%s/GroupPatterns/config.xml' % repo)
+ # verify attributes for configuration entries
+ # (as defined in doc/server/configurationentries)
+ # TODO: See if it is possible to do this in the schema instead
+ configuration_attrs = {
+ 'device':['name', 'owner', 'group', 'dev_type'],
+ 'directory':['name', 'owner', 'group', 'perms'],
+ 'file':['name', 'owner', 'group', 'perms', 'encoding', 'empty'],
+ 'hardlink':['name', 'to'],
+ 'symlink':['name', 'to'],
+ 'ignore':['name'],
+ 'nonexist':['name'],
+ 'permissions':['name', 'owner', 'group', 'perms']}
+ for rfile in rules_list:
+ try:
+ xdata = lxml.etree.parse(rfile)
+ except lxml.etree.XMLSyntaxError, e:
+ print("Failed to parse %s: %s" % (plist, e))
+ for posixpath in xdata.findall("//Path"):
+ pathname = posixpath.get('name')
+ pathtype = posixpath.get('type')
+ pathset = set(posixpath.attrib.keys())
+ try:
+ required_attrs = set(configuration_attrs[pathtype] \
+ + ['type'])
+ except KeyError:
+ continue
+ if pathset.issuperset(required_attrs):
+ continue
+ else:
+ print("The following required attributes are missing for"
+ " Path %s in %s: %s" % (pathname, rfile,
+ [attr for attr in required_attrs.difference(pathset)]))
+
# warn on duplicate Pkgmgr entries with the same priority
pset = set()
for plist in pkg_list: