Michael Ablassmeier
2021-May-24 19:27 UTC
[Libguestfs] [nbdkit PATCH 1/1] python: cleanup examples
Examples use print() instead of nbdkit.debug() to print debugging information, which doesnt work. Replace calls to print with debug function. Signed-off-by: Michael Ablassmeier <abi at grinser.de> --- plugins/python/examples/ramdisk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/python/examples/ramdisk.py b/plugins/python/examples/ramdisk.py index 2cde6aab..412ad31b 100644 --- a/plugins/python/examples/ramdisk.py +++ b/plugins/python/examples/ramdisk.py @@ -43,11 +43,11 @@ API_VERSION = 2 # This just prints the extra command line parameters, but real plugins # should parse them and reject any unknown parameters. def config(key, value): - print("ignored parameter %s=%s" % (key, value)) + nbdkit.debug("ignored parameter %s=%s" % (key, value)) def open(readonly): - print("open: readonly=%d" % readonly) + nbdkit.debug("open: readonly=%d" % readonly) # You can return any non-NULL Python object from open, and the # same object will be passed as the first arg to the other -- 2.30.2
Richard W.M. Jones
2021-May-24 20:38 UTC
[Libguestfs] [nbdkit PATCH 1/1] python: cleanup examples
On Mon, May 24, 2021 at 09:27:17PM +0200, Michael Ablassmeier wrote:> Examples use print() instead of nbdkit.debug() to print debugging > information, which doesnt work. Replace calls to print with debug > function. > > Signed-off-by: Michael Ablassmeier <abi at grinser.de> > --- > plugins/python/examples/ramdisk.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/plugins/python/examples/ramdisk.py b/plugins/python/examples/ramdisk.py > index 2cde6aab..412ad31b 100644 > --- a/plugins/python/examples/ramdisk.py > +++ b/plugins/python/examples/ramdisk.py > @@ -43,11 +43,11 @@ API_VERSION = 2 > # This just prints the extra command line parameters, but real plugins > # should parse them and reject any unknown parameters. > def config(key, value): > - print("ignored parameter %s=%s" % (key, value)) > + nbdkit.debug("ignored parameter %s=%s" % (key, value)) > > > def open(readonly): > - print("open: readonly=%d" % readonly) > + nbdkit.debug("open: readonly=%d" % readonly) > > # You can return any non-NULL Python object from open, and the > # same object will be passed as the first arg to the otherThanks - I pushed it. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top