Project

General

Profile

Bug #23707

UnboundLocalError if command doesn't validate

Added by Kefu Chai almost 6 years ago. Updated almost 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
luminous
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

The error case in validate_command() where the command is found but the
command itself is somehow invalid raises an UnboundLocalError, because it
tries to refer to a variable named 'e', but it should be 'ex'. For example:

  1. ceph balancer mode
    Traceback (most recent call last):
    File "/usr/bin/ceph", line 1178, in <module>
    retval = main()
    File "/usr/bin/ceph", line 1109, in main
    verbose)
    File "/usr/bin/ceph", line 535, in new_style_command
    valid_dict = validate_command(sigdict, cmdargs, verbose)
    File "/usr/lib/python3.6/site-packages/ceph_argparse.py", line 1090, in validate_command
    print("Invalid command:", e, file=sys.stderr)
    UnboundLocalError: local variable 'e' referenced before assignment

Related issues

Copied to Ceph - Backport #23708: luminous: UnboundLocalError if command doesn't validate Rejected

History

#2 Updated by Kefu Chai almost 6 years ago

  • Copied to Backport #23708: luminous: UnboundLocalError if command doesn't validate added

#3 Updated by Kefu Chai almost 6 years ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF