Make network_vlan OpParam of OpNetworkConnect default to the empty
string and thus make it optional (see defaultField definition). This
way we keep backwards compatibility with old RAPI.

To bypass a sphinx warning (i.e. Inline literal start-string without
end-string), substitute "" with "EmptyString" in the generated html.

Signed-off-by: Dimitris Aragiorgis <[email protected]>
---
 lib/build/sphinx_ext.py |    2 ++
 src/Ganeti/OpParams.hs  |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/build/sphinx_ext.py b/lib/build/sphinx_ext.py
index 5f29473..9cceee9 100644
--- a/lib/build/sphinx_ext.py
+++ b/lib/build/sphinx_ext.py
@@ -173,6 +173,8 @@ def _BuildOpcodeParams(op_id, include, exclude, alias):
     if has_default or has_test:
       buf.write(" (")
       if has_default:
+        if default == "":
+          default = "EmptyString"
         buf.write("defaults to ``%s``" % (default,))
         if has_test:
           buf.write(", ")
diff --git a/src/Ganeti/OpParams.hs b/src/Ganeti/OpParams.hs
index ae00822..b0c6581 100644
--- a/src/Ganeti/OpParams.hs
+++ b/src/Ganeti/OpParams.hs
@@ -1634,5 +1634,5 @@ pNetworkLink =
 
 pNetworkVlan :: Field
 pNetworkVlan =
-  withDoc "Network vlan when connecting to a group" $
-  simpleField "network_vlan" [t| String |]
+  withDoc "Network vlan when connecting to a group" .
+  defaultField [| "" |] $ stringField "network_vlan"
-- 
1.7.10.4

Reply via email to