glance-manage: fix crash under Python3.11
In Python3.11, the argparse module became stricter. While the following code was fine in previous versions, it will now raise an argparse.ArgumentError because we added the same subparser twice: import argparse parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(title='Commands') subparsers.add_parser('foo') subparsers.add_parser('foo') subparsers.add_parser('bar') parser.parse_args() This mistake was silently ignore in Python3.10, which explains why this was never an issue for glance-manage. Closes-Bug: #1982426 Change-Id: I3a88ab5d2e67a1553f03b0b8ba44efbef976ffb0
This commit is contained in:
parent
00f453372c
commit
76abb227ad
|
@ -504,7 +504,7 @@ def add_command_parsers(subparsers):
|
|||
|
||||
parser.add_argument('action_args', nargs='*')
|
||||
|
||||
add_legacy_command_parsers(command_object, subparsers)
|
||||
add_legacy_command_parsers(command_object, subparsers)
|
||||
|
||||
|
||||
command_opt = cfg.SubCommandOpt('command',
|
||||
|
|
Loading…
Reference in New Issue