[ovs-dev] [idl 3/4] ovsdb-idl: Improve ovsdb_idl_txn_increment() interface.
Reid Price
reid at nicira.com
Tue Mar 27 18:10:17 PDT 2012
Glanced at python, seems good
On Tue, Mar 27, 2012 at 5:00 PM, Ben Pfaff <blp at nicira.com> wrote:
> The previous interface was just bizarre.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> tests/test-ovsdb.py | 14 ++++++++++----
>
> <snip>
> diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
> index b0e42a3..77b3a2c 100644
> --- a/tests/test-ovsdb.py
> +++ b/tests/test-ovsdb.py
> @@ -1,4 +1,4 @@
> -# Copyright (c) 2009, 2010, 2011 Nicira Networks
> +# Copyright (c) 2009, 2010, 2011, 2012 Nicira Networks
> #
> # Licensed under the Apache License, Version 2.0 (the "License");
> # you may not use this file except in compliance with the License.
> @@ -292,11 +292,17 @@ def idl_set(idl, commands, step):
> '"%s"\n' % args[1])
> sys.exit(1)
> elif name == "increment":
> - if len(args) != 2:
> - sys.stderr.write('"increment" command requires 2
> arguments\n')
> + if len(args) != 1:
> + sys.stderr.write('"increment" command requires 1
> argument\n')
> + sys.exit(1)
> +
>
It might be nice to just cast this to int once, you get some free
documentation (in the form of a variable name) for args[0] too.
> + s = idltest_find_simple(idl, int(args[0]))
> + if not s:
> + sys.stderr.write('"set" command asks for nonexistent
> i=%d\n'
> + % int(args[0]))
> sys.exit(1)
>
> - txn.increment(args[0], args[1], [])
> + s.increment("i")
> increment = True
> elif name == "abort":
> txn.abort()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/dev/attachments/20120327/6de431ef/attachment.htm>
More information about the dev
mailing list