Skip to content

[st2client/RFI] It's hard to set array of object in an action parameter. #3646

@userlocalhost

Description

@userlocalhost

Background / Problem

We can easily set object type values in a action parameter by the past efforts of the Team, like this.

$ st2 run some_pack.action param_obj='foo=bar,hoge=fuga'

In the similar way, we can do it for array type values, as follows.

$ st2 run some_pack.action param_arr='foo,bar,baz'

But it's quite difficult to set 'array of object' value, like following.

$ st2 run some_pack.action param_arr_obj=['{"foo": "bar"}','{"hoge": "fuga"}']

(Even if only a white space after comma is not permitted)

Currently, I can seldom see the action that requiresarray of object type value in a parameter.
But I think this restriction prevents to make it.

Suggestion

One of an idea to improve it is permitting to specify values more than once only if the array type parameter, as follows.

$ st2 run some_pack.action \
    param_arr_obj='foo=bar'
    param_arr_obj='hoge=fuga'

Internally, the param_arr_obj transforms as follows.

[{'foo': 'bar'}, {'hoge': 'fuga'}]

In this solution, I think there are following advantages.

  • (User friendly) This easily makes array of object using past assets.
  • (Backward compatibility) This doesn't change current UI.

Could you please let me know what you think about it?

Thank you

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