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

Preserve type in ActionChain publish variables #1231

Open
manasdk opened this issue Mar 6, 2015 · 6 comments
Open

Preserve type in ActionChain publish variables #1231

manasdk opened this issue Mar 6, 2015 · 6 comments

Comments

@manasdk
Copy link
Contributor

manasdk commented Mar 6, 2015

Since ActionChain publishing uses Jinja the types for published variables are not preserved and everything gets a string representation.

Fix either by switch all this to YAQL or some other post-jinja magic.

@arm4b
Copy link
Member

arm4b commented Jun 11, 2015

The same is for actions, right?

Wanted to edit load.yml:

---
  name: "load"
  runner_type: "local-shell-cmd"
  description: "Action that reloads all st2 content."
  enabled: true
  entry_point: ""
  parameters:
    sudo:
      immutable: true
    cmd:
      immutable: true
      # this line :(
      # 'register' is a string, man: ["actions", "aliases", "sensors"]
      default: "st2 reload{% for item in register %} --register-{{item}}{% endfor %}"
    register:
      type: "array"
      items:
        type: "string"
      default:
        - "actions"
        - "aliases"
        - "sensors"
      description: "Possible options are all, sensors, actions, rules, aliases."
    kwarg_op:
      immutable: true

And cried here:

    cmd:
      immutable: true
      default: "echo '{{ register|join('-') }}'"
    register:
      type: "array"
      items:
        type: "string"
      default:
        - "actions"
        - "aliases"
        - "sensors"

->
[-"-a-c-t-i-o-n-s-"-,- -"-a-l-i-a-s-e-s-"-,- -"-s-e-n-s-o-r-s-"-]

Or I'm doing something wrong?

@lakshmi-kannan
Copy link
Contributor

@armab I am not sure what you want the cmd as in simple text?

@arm4b
Copy link
Member

arm4b commented Jun 11, 2015

@lakshmi-kannan I expected I can work with {{ register }} variable as a sequence. Is it possible to do?

@lakshmi-kannan
Copy link
Contributor

{% for item in register %} --register-{{item}}{% endfor %} like in original load.yaml is a sequence, right?

@manasdk
Copy link
Contributor Author

manasdk commented Jun 12, 2015

@armab Not sure why this borked when you tried to use an array. Most likely the jinja template.

@enykeev
Copy link
Member

enykeev commented Nov 18, 2016

Confirming still a problem. Potential solution might be to use callable_expression jinja method when template consist of only a single jinja variable. The potential consequences for existing chains are going to be severe.

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

No branches or pull requests

4 participants