Validate presence of xml:id in section
In tools/validate.py, check for xml:id attributes. While testing this, found a file that contained missing xml:id, that was corrected. See bug #1181659 Change-Id: I61f61c5f6de87bee8c7bc2eb9e3bfe23426a3adb
This commit is contained in:
@@ -7,40 +7,40 @@
|
||||
<para>You can use OpenStack Image Services for discovering, registering, and retrieving virtual machine images. The service includes a RESTful API that allows users to query VM image metadata and retrieve the actual image with HTTP requests, or you can use a client class in your Python code to accomplish the same tasks.
|
||||
</para><para>
|
||||
VM images made available through OpenStack Image Service can be stored in a variety of locations from simple file systems to object-storage systems like the OpenStack Object Storage project, or even use S3 storage either on its own or through an OpenStack Object Storage S3 interface.</para>
|
||||
<section>
|
||||
<section xml:id="overview-of-architecture">
|
||||
<?dbhtml filename="overview-of-architecture.html" ?>
|
||||
<title>Overview of Architecture</title>
|
||||
<para>There are two main parts to the Image Service’s architecture:</para>
|
||||
|
||||
|
||||
<itemizedlist><listitem><para>API server</para></listitem>
|
||||
<listitem><para>Registry server(s)</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
|
||||
<para>OpenStack Image Service is designed to be as adaptable as possible for various back-end storage and registry database solutions. There is a main API server (the ``glance-api`` program) that serves as the communications hub betweenvarious client programs, the registry of image metadata, and the storage systems that actually contain the virtual machine image data.</para>
|
||||
</section>
|
||||
<section>
|
||||
<section xml:id="openstack-imaging-service-api-server">
|
||||
<?dbhtml filename="openstack-imaging-service-api-server.html" ?>
|
||||
<title>OpenStack Image Service API Server</title>
|
||||
|
||||
|
||||
<para>The API server is the main interface for OpenStack Image Service. It routes requests from clients to registries of image metadata and to its backend stores, which are the mechanisms by which OpenStack Image Service actually saves incoming virtual machine images.</para>
|
||||
|
||||
|
||||
<para>The backend stores that OpenStack Image Service can work with are as follows:</para>
|
||||
<itemizedlist><listitem><para>OpenStack Object Storage - OpenStack Object Storage is the highly-available object storage project in OpenStack.</para></listitem>
|
||||
|
||||
<itemizedlist><listitem><para>OpenStack Object Storage - OpenStack Object Storage is the highly-available object storage project in OpenStack.</para></listitem>
|
||||
|
||||
<listitem><para>Filesystem - The default backend that OpenStack Image Service uses to store virtual machine images is the filesystem backend. This simple backend writes image files to the local filesystem.</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>S3 - This backend allows OpenStack Image Service to store virtual machine images in Amazon’s S3 service.</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>HTTP - OpenStack Image Service can read virtual machine images that are available via HTTP somewhere on the Internet. This store is readonly.</para></listitem></itemizedlist>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<section xml:id="openstack-imaging-service-registry-servers">
|
||||
<?dbhtml filename="openstack-imaging-service-registry-servers.html" ?>
|
||||
<title>OpenStack Image Service Registry Servers</title>
|
||||
|
||||
|
||||
<para>OpenStack Image Service registry servers are servers that conform to the OpenStack Image Service Registry API. OpenStack Image Service ships with a reference implementation of a registry server that complies with this API (bin/OpenStack Image Service-registry).</para></section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -44,6 +44,17 @@ def validation_failed(schema, doc):
|
||||
any(log.type_name != "DTD_UNKNOWN_ID" for log in schema.error_log)
|
||||
|
||||
|
||||
def verify_section_tags_have_xmid(doc):
|
||||
"""Check that all section tags have an xml:id attribute
|
||||
|
||||
Will throw an exception if there's at least one missing"""
|
||||
ns = {"docbook": "http://docbook.org/ns/docbook"}
|
||||
for node in doc.xpath('//docbook:section', namespaces=ns):
|
||||
if "{http://www.w3.org/XML/1998/namespace}id" not in node.attrib:
|
||||
raise ValueError("section missing xml:id attribute, line %d" %
|
||||
node.sourceline)
|
||||
|
||||
|
||||
def error_message(error_log):
|
||||
"""Return a string that contains the error message.
|
||||
|
||||
@@ -78,9 +89,13 @@ def main(rootdir):
|
||||
if validation_failed(schema, doc):
|
||||
any_failures = True
|
||||
print error_message(schema.error_log)
|
||||
verify_section_tags_have_xmid(doc)
|
||||
except etree.XMLSyntaxError as e:
|
||||
any_failures = True
|
||||
print "%s: %s" % (path, e)
|
||||
except ValueError as e:
|
||||
any_failures = True
|
||||
print "%s: %s" % (path, e)
|
||||
|
||||
if any_failures:
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user