Fix tobiko-fixture subcommand.

With Python 2.7.5 tobiko where not properly getting the
right value for args.subcommand value and always
printing help message instead of executing any other
action.

The bug has been fixed by setting default value to
subparser instead of the parser. By change it where working
fine on last versions of Python 2.7, and therefore the
bug lied undetected for some months.

Thanks Pini to catching it while working on Tobiko infrared
plugin.

Change-Id: I4b626e8792c49a1402c232f927600ccac4282ac5
This commit is contained in:
Federico Ressi 2019-05-20 07:55:48 +02:00
parent c77c913f5b
commit 879293054b

View File

@ -29,12 +29,12 @@ class FixtureUtil(base.TobikoCMD):
def get_parser(self):
parser = super(FixtureUtil, self).get_parser()
subparsers_params = {}
subparsers = parser.add_subparsers(**subparsers_params)
subparsers = parser.add_subparsers(
title='subcommands', description='fixture operation')
parser.set_defaults(subcommand='help')
subcommand_parser = subparsers.add_parser(
'help', help=('show this help message'))
subcommand_parser.set_defaults(subcommand='help')
for subcommand_name in ['cleanup', 'list', 'setup']:
subcommand_parser = subparsers.add_parser(