summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorFabian Affolter <fabian@bernewireless.net>2010-08-13 18:40:54 +0000
committerSol Jerome <sol.jerome@gmail.com>2010-08-14 21:26:25 -0500
commit3aed1086233473a5262a58bb6d87c8127a076e58 (patch)
treea190594dc9f1330a6559b34f094ec695b474a98a /src/sbin
parent893128d66e6ce51bed788c16cb5aa3578b354142 (diff)
downloadbcfg2-3aed1086233473a5262a58bb6d87c8127a076e58.tar.gz
bcfg2-3aed1086233473a5262a58bb6d87c8127a076e58.tar.bz2
bcfg2-3aed1086233473a5262a58bb6d87c8127a076e58.zip
Quick hack to fix #910
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@6017 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg2-repo-validate31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate
index d187441ed..a2047197c 100755
--- a/src/sbin/bcfg2-repo-validate
+++ b/src/sbin/bcfg2-repo-validate
@@ -23,6 +23,14 @@ if __name__ == '__main__':
cpath = setup['configfile']
prefix = setup['prefix']
schemadir = "%s/share/bcfg2/schemas" % (prefix)
+ # On openSuSE the manual installation puts the schemas under
+ # /usr/local/share/... . On Fedora and maybe other systems the
+ # path is correct: /usr/share/bcfg2/schemas
+ # FIXME: This needs further investigation.
+ if os.path.isdir(schemadir):
+ pass
+ else:
+ schemadir = "/usr/local/share/bcfg2/schemas"
os.chdir(schemadir)
repo = setup['repo']
@@ -34,7 +42,7 @@ if __name__ == '__main__':
if filename == 'info.xml':
info_list.append(os.path.join(root, filename))
- # get metadata list (with all included files)
+ # Get metadata list (with all included files)
metadata_list = glob.glob("%s/Metadata/groups.xml" % repo)
ref_bundles = set()
xdata = lxml.etree.parse("%s/Metadata/groups.xml" % repo)
@@ -54,7 +62,7 @@ if __name__ == '__main__':
included.add(ent)
included.discard(filename)
- # check for multiple default group definitions
+ # Check for multiple default group definitions
default_groups=[]
for grp in lxml.etree.parse("%s/Metadata/groups.xml" \
% repo).findall('.//Group'):
@@ -65,12 +73,12 @@ if __name__ == '__main__':
for grp in default_groups:
print(" %s" % grp.get('name'))
- # get all XIncluded bundles
+ # Get all XIncluded bundles
xdata.xinclude()
for bundle in xdata.findall("//Bundle"):
ref_bundles.add("%s/Bundler/%s" % (repo, bundle.get('name')))
- # get lists of all other xml files to validate
+ # Get lists of all other xml files to validate
clients_list = glob.glob("%s/Metadata/clients.xml" % repo)
bundle_list = glob.glob("%s/Bundler/*.xml" % repo)
genshibundle_list = glob.glob("%s/Bundler/*.genshi" % repo)
@@ -84,7 +92,7 @@ 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
+ # 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 = {
@@ -117,14 +125,14 @@ if __name__ == '__main__':
" Path %s in %s: %s" % (pathname, rfile,
[attr for attr in required_attrs.difference(pathset)]))
- # warn on duplicate Pkgmgr entries with the same priority
+ # Warn on duplicate Pkgmgr entries with the same priority
pset = set()
for plist in pkg_list:
try:
xdata = lxml.etree.parse(plist)
except lxml.etree.XMLSyntaxError, e:
print("Failed to parse %s: %s" % (plist, e))
- # get priority, type, group
+ # Get priority, type, group
priority = xdata.getroot().get('priority')
ptype = xdata.getroot().get('type')
for pkg in xdata.findall("//Package"):
@@ -133,7 +141,7 @@ if __name__ == '__main__':
else:
grp = 'none'
ptuple = (pkg.get('name'), priority, ptype, grp)
- # check if package is already listed with same priority,
+ # Check if package is already listed with same priority,
# type, grp
if ptuple in pset:
print("Duplicate Package %s, priority:%s, type:%s"\
@@ -191,11 +199,11 @@ if __name__ == '__main__':
elif verbose:
print("%s checks out" % (filename))
- # print out missing bundle information
+ # Print out missing bundle information
if verbose:
print("")
for bundle in ref_bundles:
- # check for both regular and genshi bundles
+ # Check for both regular and genshi bundles
xmlbundle = "%s.xml" % bundle
genshibundle = "%s.genshi" % bundle
allbundles = bundle_list + genshibundle_list
@@ -203,7 +211,7 @@ if __name__ == '__main__':
genshibundle not in allbundles:
print("*** Warning: Bundle %s referenced, but does not "
"exist." % bundle)
- # verify bundle name attribute matches filename
+ # Verify bundle name attribute matches filename
for bundle in (bundle_list + genshibundle_list):
fname = bundle.split('Bundler/')[1].split('.')[0]
xdata = lxml.etree.parse(bundle)
@@ -213,5 +221,4 @@ if __name__ == '__main__':
print(" Filename is %s" % fname)
print(" Bundle name found in %s is %s" % (fname, bname))
-
raise SystemExit, failures