Quantumclient shell failed to parse the subclass commands

Bug #1116837 reported by Jason
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Undecided
Jason

Bug Description

Currently the quantumclient shell cannot parse the subclass command since the command list is hard-coded in the source code.
if some subclass derived from the quantumclient, the commands in subclass cannot be parsed.

    def run(self, argv):
        """Equivalent to the main program for the application.

        :param argv: input arguments and options
        :paramtype argv: list of str
        """
        try:
            index = 0
            command_pos = -1
            help_pos = -1
            help_command_pos = -1
            for arg in argv:
                if arg == 'bash-completion':
                    self._bash_completion()
                    return 0
                if arg in COMMANDS[self.api_version]: <-------- Here, COMMNADS is hard-coded.
                    if command_pos == -1:
                        command_pos = index
                elif arg in ('-h', '--help'):
                    if help_pos == -1:
                        help_pos = index
                elif arg == 'help':
                    if help_command_pos == -1:
                        help_command_pos = index
                index = index + 1
            if command_pos > -1 and help_pos > command_pos:
                argv = ['help', argv[command_pos]]
            if help_command_pos > -1 and command_pos == -1:
                argv[help_command_pos] = '--help'
            self.options, remainder = self.parser.parse_known_args(argv)
            self.configure_logging()
            self.interactive_mode = not remainder
            self.initialize_app(remainder)
        except Exception as err:

Jason (zzs)
Changed in python-quantumclient:
assignee: nobody → Jason Zhang (zzs)
Jason (zzs)
Changed in python-quantumclient:
assignee: Jason Zhang (zzs) → nobody
Jason (zzs)
Changed in python-quantumclient:
assignee: nobody → Jason Zhang (zzs)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-quantumclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/21348

Changed in python-quantumclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-quantumclient (master)

Reviewed: https://review.openstack.org/21348
Committed: http://github.com/openstack/python-quantumclient/commit/4f3b47d596b9e777828575fe2012ffe2bcbfa7c9
Submitter: Jenkins
Branch: master

commit 4f3b47d596b9e777828575fe2012ffe2bcbfa7c9
Author: Jason Zhang <email address hidden>
Date: Tue Feb 5 17:51:20 2013 -0800

    Stored the quantum commands list to the variable.

    By storing the quantum commands list to
    the variable, the subclass can depend
    the quantum shell to parse the command.

    Fixes: bug 1116837

    Change-Id: I0a6f3226d326cf015e262e4ddf364d6f9a91d041

Changed in python-quantumclient:
status: In Progress → Fix Committed
Changed in python-quantumclient:
milestone: none → 2.1
Akihiro Motoki (amotoki)
Changed in python-quantumclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.