Skip to content

unable to have array of objects in a parameter #3362

@AndyMoore111

Description

@AndyMoore111

when using the aws.autoscaling_create_launch_configuration action the BlockDeviceMappings parameter requires an array of objects (list of dictionaries) as its argument

however in the st2 web interface if you try to add a dictionary it splits on ',' and throws errors:

  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/runners/python_action_wrapper.py", line 242, in <module>
    obj.run()
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/runners/python_action_wrapper.py", line 154, in run
    output = action.run(**self._parameters)
  File "/opt/stackstorm/packs/aws/actions/run.py", line 20, in run
    return self.do_method(module_path, cls, action, **kwargs)
  File "/opt/stackstorm/packs/aws/actions/lib/action.py", line 140, 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 BlockDeviceMappings[0], value: [{"DeviceName": "/dev/sda1", type: <type 'unicode'>, valid types: <type 'dict'>
Invalid type for parameter BlockDeviceMappings[1], value: "Ebs": {"DeleteOnTermination": true, type: <type 'unicode'>, valid types: <type 'dict'>
Invalid type for parameter BlockDeviceMappings[2], value: "VolumeType": "standard", type: <type 'unicode'>, valid types: <type 'dict'>
Invalid type for parameter BlockDeviceMappings[3], value: "VolumeSize": 40}}'], type: <type 'unicode'>, valid types: <type 'dict'>

Entered:

{"DeviceName": "/dev/sda1", "Ebs": {"DeleteOnTermination": true,"VolumeType": "standard","VolumeSize": 40}}

If I change the type to an object:

[{"DeviceName": "/dev/sda1", "Ebs": {"DeleteOnTermination": true,"VolumeType": "standard","VolumeSize": 40}}]

the validation says 'value is not an object'

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