Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camqadm error, and fix #257

Closed
dpwhite2 opened this issue Nov 22, 2010 · 1 comment
Closed

camqadm error, and fix #257

dpwhite2 opened this issue Nov 22, 2010 · 1 comment

Comments

@dpwhite2
Copy link
Contributor

On the current master (and I think it at least affects the 2.1.x series as well), using camqadm with yes/no options throws 'too many values to unpack' exceptions.

This recreates the error:

camqadm queue.declare myqueue no yes no no

Using the same command, but without the yes/no options does not raise an exception.

Here is the current contents of the Spec.coerce() method in the celery.bin.camqadm module, followed by my proposed fix:

Current camqadm.py (lines 69-81):

def coerce(self, index, value):
    """Coerce value for argument at index.

    E.g. if :attr:`args` is `[("is_active", bool)]`:

        >>> coerce(0, "False")
        False

    """
    arg_name, arg_type = self.args[index]
    # Might be a custom way to coerce the string value,
    # so look in the coercion map.
    return COERCE.get(arg_type, arg_type)(value)

Here is my suggested fix:

def coerce(self, index, value):
    """Coerce value for argument at index.

    E.g. if :attr:`args` is `[("is_active", bool)]`:

        >>> coerce(0, "False")
        False

    """
    arg_info = self.args[index]
    arg_type = arg_info[1]
    # Might be a custom way to coerce the string value,
    # so look in the coercion map.
    return COERCE.get(arg_type, arg_type)(value)

The fix is only a couple of lines, so I'm hoping posting it here is acceptable instead of doing a full pull request.

Thanks,
David White

@ask
Copy link
Contributor

ask commented Nov 23, 2010

camqadm: Fixed syntax error when providing options to commands. Closed by 83cde80. Thanks to dpwhite2

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants