All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] tools: efivar.py without arguments
@ 2021-01-09  0:55 Heinrich Schuchardt
  2021-01-11 14:12 ` Paulo Alcantara
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2021-01-09  0:55 UTC (permalink / raw)
  To: u-boot

When tools: efivar.py is called without arguments an error occurs:

Traceback (most recent call last):
  File "tools/efivar.py", line 380, in <module>
    main()
  File "tools/efivar.py", line 360, in main
    args.func(args)
AttributeError: 'Namespace' object has no attribute 'func'

Show the online help if the arguments do not specify a function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 tools/efivar.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/efivar.py b/tools/efivar.py
index ebfcab2f0a..c40a0fa6c7 100755
--- a/tools/efivar.py
+++ b/tools/efivar.py
@@ -357,7 +357,10 @@ def main():
     signp.set_defaults(func=cmd_sign)

     args = ap.parse_args()
-    args.func(args)
+    if hasattr(args, "func"):
+        args.func(args)
+    else:
+        ap.print_help()

 def group(a, *ns):
     for n in ns:
--
2.29.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 1/1] tools: efivar.py without arguments
  2021-01-09  0:55 [PATCH 1/1] tools: efivar.py without arguments Heinrich Schuchardt
@ 2021-01-11 14:12 ` Paulo Alcantara
  0 siblings, 0 replies; 2+ messages in thread
From: Paulo Alcantara @ 2021-01-11 14:12 UTC (permalink / raw)
  To: u-boot

Heinrich Schuchardt <xypron.glpk@gmx.de> writes:

> When tools: efivar.py is called without arguments an error occurs:
>
> Traceback (most recent call last):
>   File "tools/efivar.py", line 380, in <module>
>     main()
>   File "tools/efivar.py", line 360, in main
>     args.func(args)
> AttributeError: 'Namespace' object has no attribute 'func'
>
> Show the online help if the arguments do not specify a function.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  tools/efivar.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-11 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09  0:55 [PATCH 1/1] tools: efivar.py without arguments Heinrich Schuchardt
2021-01-11 14:12 ` Paulo Alcantara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.