Skip to content

Invalid type for parameter Filters[0] when filtering for tags #108

Open
@drksnw

Description

@drksnw

Hello,

I have a problem with the ec2_describe_instances action.

Calling the action without any filter works well, however I would need to only get instances with a specific tag.

I tried adding the Filters parameter like this : Filters=tag:Name=test-instance however, it crashes at botocore as it need to have a dict instead of a string.

I've also tried to write the filter like a dict (with { and }), but it seems that the parameter is always casted to a string, which breaks the functionality.

Here is the full stack trace :

st2.actions.python.ActionManager: DEBUG    Calling method "boto3.ec2.describe_instances" with kwargs: {u'Filters': [u'tag:Name=test-instance']}
Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/python_runner/python_action_wrapper.py", line 333, in <module>
    obj.run()
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/python_runner/python_action_wrapper.py", line 192, in run
    output = action.run(**self._parameters)
  File "/opt/stackstorm/packs/aws/actions/run.py", line 36, in run
    return self.do_method(module_path, cls, aws_action, **kwargs)
  File "/opt/stackstorm/packs/aws/actions/lib/action.py", line 226, in do_method
    resultset = getattr(obj, action)(**kwargs)
  File "/opt/stackstorm/virtualenvs/aws/lib/python2.7/site-packages/botocore/client.py", line 251, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/opt/stackstorm/virtualenvs/aws/lib/python2.7/site-packages/botocore/client.py", line 513, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/opt/stackstorm/virtualenvs/aws/lib/python2.7/site-packages/botocore/client.py", line 566, in _convert_to_request_dict
    api_params, operation_model)
  File "/opt/stackstorm/virtualenvs/aws/lib/python2.7/site-packages/botocore/validate.py", line 270, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter Filters[0], value: tag:Name=test-instance, type: <type 'unicode'>, valid types: <type 'dict'>

Do you know if I'm using the Filters parameter wrong, or is there any other problem ?

Thanks in advance for your help !

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions