Add optional formatting for OP_DSC_FIELD
authorIustin Pop <iustin@google.com>
Mon, 10 Dec 2012 08:27:07 +0000 (09:27 +0100)
committerIustin Pop <iustin@google.com>
Mon, 17 Dec 2012 11:29:32 +0000 (12:29 +0100)
commit8bc17ebb9a35d93fe4ea052aa4c09790fad1be08
tree4c95f66c9229dd274b124ac5ac2414367faa3500
parent5cd95d46141999f258d936155120844136e9bf20
Add optional formatting for OP_DSC_FIELD

For some opcodes, the output is not "stable", and depends on the exact
input values; this makes it harder to check consistency against
Haskell code.

To compensate for this, we add a way to override the formatting of the
OP_DSC_FIELD; by default, this is always "%s", but if the
OP_DSC_FORMATTER is defined (must be a callable), it is used to format
the actual value.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
lib/opcodes.py
test/ganeti.opcodes_unittest.py