diff mbox series

usertools/pmdinfo: fix plugin auto scan

Message ID 20211019125230.27480-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers show
Series usertools/pmdinfo: fix plugin auto scan | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-spell-check-testing warning Testing issues
ci/checkpatch success coding style OK

Commit Message

David Marchand Oct. 19, 2021, 12:52 p.m. UTC
Migration to argparse was incomplete.

$ dpdk-pmdinfo.py -p $(which dpdk-testpmd)
Traceback (most recent call last):
  File "/usr/bin/dpdk-pmdinfo.py", line 626, in <module>
    main()
  File "/usr/bin/dpdk-pmdinfo.py", line 596, in main
    exit(scan_for_autoload_pmds(args[0]))
TypeError: 'Namespace' object does not support indexing

Fixes: 81255f27c65c ("usertools: replace optparse with argparse")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 usertools/dpdk-pmdinfo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Robin Jarry Oct. 20, 2021, 7:31 p.m. UTC | #1
Hello,

2021-10-19, David Marchand:
> Migration to argparse was incomplete.
> 
> $ dpdk-pmdinfo.py -p $(which dpdk-testpmd)
> Traceback (most recent call last):
>   File "/usr/bin/dpdk-pmdinfo.py", line 626, in <module>
>     main()
>   File "/usr/bin/dpdk-pmdinfo.py", line 596, in main
>     exit(scan_for_autoload_pmds(args[0]))
> TypeError: 'Namespace' object does not support indexing
> 
> Fixes: 81255f27c65c ("usertools: replace optparse with argparse")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

It is sad that pylint does not report an error:

https://pycodequ.al/docs/pylint-messages/e1136-unsubscriptable-object.html

Anyway, this fix looks good.

Reviewed-by: Robin Jarry <robin.jarry@6wind.com>
Thomas Monjalon Oct. 25, 2021, 3:10 p.m. UTC | #2
20/10/2021 21:31, Robin Jarry:
> Hello,
> 
> 2021-10-19, David Marchand:
> > Migration to argparse was incomplete.
> > 
> > $ dpdk-pmdinfo.py -p $(which dpdk-testpmd)
> > Traceback (most recent call last):
> >   File "/usr/bin/dpdk-pmdinfo.py", line 626, in <module>
> >     main()
> >   File "/usr/bin/dpdk-pmdinfo.py", line 596, in main
> >     exit(scan_for_autoload_pmds(args[0]))
> > TypeError: 'Namespace' object does not support indexing
> > 
> > Fixes: 81255f27c65c ("usertools: replace optparse with argparse")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> 
> It is sad that pylint does not report an error:
> 
> https://pycodequ.al/docs/pylint-messages/e1136-unsubscriptable-object.html
> 
> Anyway, this fix looks good.
> 
> Reviewed-by: Robin Jarry <robin.jarry@6wind.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py
index 3381aa616c..40ef5cec6c 100755
--- a/usertools/dpdk-pmdinfo.py
+++ b/usertools/dpdk-pmdinfo.py
@@ -593,7 +593,7 @@  def main(stream=None):
             exit(1)
 
     if args.pdir:
-        exit(scan_for_autoload_pmds(args[0]))
+        exit(scan_for_autoload_pmds(args.elf_file))
 
     ldlibpath = os.environ.get('LD_LIBRARY_PATH')
     if ldlibpath is None: