diff --git a/lib/opcodes.py b/lib/opcodes.py index 9a3a53484a7ae948dd3222265d52fb8746e4b14e..acace935ae2a42a4a0d9d22423e8e75069460172 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -109,6 +109,9 @@ _PNodeGroupAllocPolicy = \ _PGroupNodeParams = ("ndparams", None, ht.TMaybeDict, "Default node parameters for group") +_PQueryWhat = ("what", ht.NoDefault, ht.TElemOf(constants.QR_OP_QUERY), + "Resource(s) to query for") + _PIpCheckDoc = "Whether to ensure instance's IP address is inactive" #: OP_ID conversion regular expression @@ -644,8 +647,7 @@ class OpQuery(OpCode): """ OP_PARAMS = [ - ("what", ht.NoDefault, ht.TElemOf(constants.QR_OP_QUERY), - "Resource(s) to query for"), + _PQueryWhat, ("fields", ht.NoDefault, ht.TListOf(ht.TNonEmptyString), "Requested fields"), ("filter", None, ht.TOr(ht.TNone, @@ -662,8 +664,9 @@ class OpQueryFields(OpCode): """ OP_PARAMS = [ - ("what", ht.NoDefault, ht.TElemOf(constants.QR_OP_QUERY), None), - ("fields", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)), None), + _PQueryWhat, + ("fields", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)), + "Requested fields; if not given, all are returned"), ]