Skip to contentSkip to conversation

tools: efivar.py without arguments

PATCH New Heinrich Schuchardt 2 participants 2 messages Jan 9, 2021 – Jan 11, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: efivar.py without arguments

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.

---
 tools/efivar.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/efivar.py +4 -1
index ebfcab2f0a..c40a0fa6c7 100755
@@ -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

#1 lore raw

PATCH 1/1 tools: efivar.py without arguments

Quoted 9 lines · Heinrich Schuchardt

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'

Quoted 6 lines

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

---
 tools/efivar.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)