[ovs-dev] [PATCH 1/2] ovsdb-doc: Support per-element documentation of string sets.

Ethan Jackson ethan at nicira.com
Thu Feb 9 01:29:12 UTC 2012


A future patch will need to document individual elements in a set
of strings.  Without this patch the documentation generation code
fails trying to figure out what type the value of the map is.

Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
 ovsdb/ovsdb-doc.in |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/ovsdb/ovsdb-doc.in b/ovsdb/ovsdb-doc.in
index 53292b3..8f725d7 100755
--- a/ovsdb/ovsdb-doc.in
+++ b/ovsdb/ovsdb-doc.in
@@ -185,22 +185,27 @@ def columnGroupToNroff(table, groupXml):
                     type_ = column.type.value
 
                 nameNroff = "%s : %s" % (name, key)
-                typeNroff = "optional %s" % column.type.value.toEnglish()
-                if (column.type.value.type == ovs.db.types.StringType and
-                    type_.type == ovs.db.types.BooleanType):
-                    # This is a little more explicit and helpful than
-                    # "containing a boolean"
-                    typeNroff += r", either \fBtrue\fR or \fBfalse\fR"
+
+                if column.type.value:
+                    typeNroff = "optional %s" % column.type.value.toEnglish()
+                    if (column.type.value.type == ovs.db.types.StringType and
+                        type_.type == ovs.db.types.BooleanType):
+                        # This is a little more explicit and helpful than
+                        # "containing a boolean"
+                        typeNroff += r", either \fBtrue\fR or \fBfalse\fR"
+                    else:
+                        if type_.type != column.type.value.type:
+                            type_english = type_.toEnglish()
+                            if type_english[0] in 'aeiou':
+                                typeNroff += ", containing an %s" % type_english
+                            else:
+                                typeNroff += ", containing a %s" % type_english
+                        constraints = (
+                            type_.constraintsToEnglish(escapeNroffLiteral))
+                        if constraints:
+                            typeNroff += ", %s" % constraints
                 else:
-                    if type_.type != column.type.value.type:
-                        type_english = type_.toEnglish()
-                        if type_english[0] in 'aeiou':
-                            typeNroff += ", containing an %s" % type_english
-                        else:
-                            typeNroff += ", containing a %s" % type_english
-                    constraints = type_.constraintsToEnglish(escapeNroffLiteral)
-                    if constraints:
-                        typeNroff += ", %s" % constraints
+                    typeNroff = "none"
             else:
                 nameNroff = name
                 typeNroff = typeAndConstraintsToNroff(column)
-- 
1.7.9




More information about the dev mailing list