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.
Additionally bypass a sphinx warning related to the generated html (i.e. Inline literal start-string without end-string) in case an empty string is used as default value. Signed-off-by: Dimitris Aragiorgis <[email protected]> --- lib/build/sphinx_ext.py | 5 ++++- src/Ganeti/OpParams.hs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/build/sphinx_ext.py b/lib/build/sphinx_ext.py index 5f29473..eb32c04 100644 --- a/lib/build/sphinx_ext.py +++ b/lib/build/sphinx_ext.py @@ -173,7 +173,10 @@ def _BuildOpcodeParams(op_id, include, exclude, alias): if has_default or has_test: buf.write(" (") if has_default: - buf.write("defaults to ``%s``" % (default,)) + if default == "": + buf.write("defaults to the empty string") + else: + buf.write("defaults to ``%s``" % (default,)) if has_test: buf.write(", ") if has_test: 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
