Export ndparams in RAPI node query
[ganeti-local] / lib / build / sphinx_ext.py
index 539ca67..6967a84 100644 (file)
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2011 Google Inc.
+# Copyright (C) 2011, 2012 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -45,7 +45,19 @@ from ganeti import rapi
 import ganeti.rapi.rlib2 # pylint: disable=W0611
 
 
-COMMON_PARAM_NAMES = map(compat.fst, opcodes.OpCode.OP_PARAMS)
+def _GetCommonParamNames():
+  """Builds a list of parameters common to all opcodes.
+
+  """
+  names = set(map(compat.fst, opcodes.OpCode.OP_PARAMS))
+
+  # The "depends" attribute should be listed
+  names.remove(opcodes.DEPEND_ATTR)
+
+  return names
+
+
+COMMON_PARAM_NAMES = _GetCommonParamNames()
 
 #: Namespace for evaluating expressions
 EVAL_NS = dict(compat=compat, constants=constants, utils=utils, errors=errors,
@@ -282,7 +294,7 @@ def BuildQueryFields(fields):
   defs = [(fdef.name, fdef.doc)
            for (_, (fdef, _, _, _)) in utils.NiceSort(fields.items(),
                                                       key=compat.fst)]
-  yield BuildValuesDoc(defs)
+  return BuildValuesDoc(defs)
 
 
 def BuildValuesDoc(values):