summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-01-16 15:27:05 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-01-16 15:27:05 +0000
commit8340206111ea2375589ea78ccb2142de21d292c0 (patch)
tree33fd94774e75a0715681b20571eadea645ed65a1
parent01bf54f6f65c0e9172f786afaed7abad5d92d6c1 (diff)
downloadbcfg2-8340206111ea2375589ea78ccb2142de21d292c0.tar.gz
bcfg2-8340206111ea2375589ea78ccb2142de21d292c0.tar.bz2
bcfg2-8340206111ea2375589ea78ccb2142de21d292c0.zip
Finish validation fixes for xinclude schemas
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2680 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--schemas/metadata.xsd34
-rwxr-xr-xsrc/sbin/bcfg2-repo-validate16
2 files changed, 26 insertions, 24 deletions
diff --git a/schemas/metadata.xsd b/schemas/metadata.xsd
index 7385f10f9..4432aa5d6 100644
--- a/schemas/metadata.xsd
+++ b/schemas/metadata.xsd
@@ -7,7 +7,10 @@
$Id$
</xsd:documentation>
</xsd:annotation>
-
+
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+
<xsd:simpleType name='toolsetType'>
<xsd:restriction base="xsd:string">
<xsd:pattern value="rh|debian|solaris|aix|gentoo|auto"/>
@@ -42,20 +45,17 @@
<xsd:attribute type='xsd:string' name='category' use='optional'/>
<xsd:attribute type='xsd:string' name='comment' use='optional'/>
</xsd:complexType>
-
- <xsd:element name='Groups'>
- <xsd:complexType>
- <xsd:choice minOccurs='0' maxOccurs='unbounded'>
- <xsd:element name='Group' type='groupType'/>
- <xsd:element name='Groups'>
- <xsd:complexType>
- <xsd:choice>
- <xsd:element name='Group' type='groupType'/>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- <xsd:attribute name='version' type='xsd:string'/>
- </xsd:complexType>
- </xsd:element>
+
+ <xsd:complexType name='groupsType'>
+ <xsd:choice minOccurs='0' maxOccurs='unbounded'>
+ <xsd:element name='Group' type='groupType'/>
+ <xsd:element name='Groups' type='groupsType'/>
+ </xsd:choice>
+ <xsd:attribute name='version' type='xsd:string'/>
+ <xsd:attribute name='origin' type='xsd:string'/>
+ <xsd:attribute name='revision' type='xsd:string'/>
+ <xsd:attribute ref='xml:base'/>
+ </xsd:complexType>
+
+ <xsd:element name='Groups' type='groupsType'/>
</xsd:schema>
diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate
index ab835f0a1..203a5556a 100755
--- a/src/sbin/bcfg2-repo-validate
+++ b/src/sbin/bcfg2-repo-validate
@@ -20,8 +20,6 @@ if __name__ == '__main__':
prefix = cf.get('server', 'prefix')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
prefix = '/usr'
- if verbose:
- print "Using installation prefix %s" % (prefix)
schemadir = "%s/share/bcfg2/schemas" % (prefix)
os.chdir(schemadir)
@@ -44,8 +42,6 @@ if __name__ == '__main__':
failures = 0
for k, (spec, schemaname) in filesets.iteritems():
try:
- if verbose:
- print "Processing schema %s" % (schemaname % (schemadir))
schema = lxml.etree.XMLSchema(lxml.etree.parse(open(schemaname%(schemadir))))
except:
print "Failed to process schema %s" % (schemaname%(schemadir))
@@ -67,7 +63,13 @@ if __name__ == '__main__':
if verbose:
print "%s checks out" % (filename)
else:
- print "%s ***FAILS*** to verify \t\t<----" % (filename)
- os.system("xmllint --xinclude --schema %s %s" % (schemaname % schemadir, filename))
- failures = 1
+ rc = os.system("xmllint --noout --xinclude --schema %s %s > /dev/null 2>/dev/null" % \
+ (schemaname % schemadir, filename))
+ if rc:
+ failures = 1
+ print "%s ***FAILS*** to verify \t\t<----" % (filename)
+ os.system("xmllint --noout --xinclude --schema %s %s" % \
+ (schemaname % schemadir, filename))
+ elif verbose:
+ print "%s checks out" % (filename)
raise SystemExit, failures