Skip to content

Wrong parsing of argument when passing an option #611

@nir0s

Description

@nir0s

This is what happens to me.

cfy blueprints upload /home/nir0s/repos/cloudify/simple-python-webserver-blueprint/blueprint.yaml --validate
Usage: cfy [OPTIONS] BLUEPRINT_PATH

Error: Got unexpected extra arguments (h o m e / n i r 0 s / r e p o s / c l o u d i f y / s i m p l e - p y t h o n - w e b s e r v e r - b l u e p r i n t / b l u e p r i n t . y a m l)

The command's code is:

@blueprints.command(name='upload')
@click.argument('blueprint-path', nargs=1, required=True)
@cfy.options.blueprint_id()
@cfy.options.blueprint_filename()
@cfy.options.validate
def upload(blueprint_path,
           blueprint_id,
           blueprint_filename,
           validate):
    """Upload a blueprint to the manager
    """
    ...

and cfy.options.validate is this:

        self.validate = click.option(
            '--validate',
            is_flag=True,
            help=helptexts.VALIDATE_BLUEPRINT)
...

Where this command is a part of a group called blueprints which doesn't implement any special

A few things to note:

  • When I don't provide the --validate flag, it parses well.
  • When I provide something that doesn't start with /, it also parses well.
  • I can't use the File type provided by click to verify the path because it can also be a url
  • I'm running Python 2.7.1
  • I tried Click 4 and updated 6.6 and it gave me the same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions