Coder Social home page Coder Social logo

Comments (3)

nzlosh avatar nzlosh commented on June 20, 2024

I was able to reproduce the problem and have had the time to dig into this issue a little deeper. The err-stackstorm plugin calls match via StackStorm's API and reports the actionalias doesn't exist. The bug on the plugins side is, it should have reported duplicate matches found. It should be a minor change to fix it so it reports the correct error.

Here is the test environment configuration and execution output: https://gist.github.com/nzlosh/c6d357f7891ee4080977536071dda296. You can see in the end of the gist that even st2 CLI fails to match when 4 variables are supplied.

I used the actionalias code from StackStorm to make a test script which helps visualise the matching logic.

Action Alias Tester
-------------------
Format: 'test {{arg1}}'
Text: 'test hello'
Result: {'arg1': 'hello'}

Format: 'test {{key1}} {{value1}}'
Text: 'test hello world'
Result: {'key1': 'hello', 'value1': 'world'}

Format: 'test {{key1}} {{value1}}'
Text: 'test k1 v1 k2 v2'
Result: {'key1': 'k1', 'value1': 'v1 k2 v2'}

Format: 'test {{key1}} {{value1}} {{ key2 }} {{ value2 }}'
Text: 'test k1 v1 k2 v2'
Result: {'key2': 'k2', 'key1': 'k1', 'value2': 'v2', 'value1': 'v1'}

Format: 'test {{key1}} {{value1}} {{ key2 }} {{ value2 }}'
Text: 'test k1 v1 k2 v2 k3=v3'
Result: {'k3': 'v3', 'key2': 'k2', 'key1': 'k1', 'value2': 'v2', 'value1': 'v1'}

Do you think it's possible to use extra Key-Value Parameters as describe here and just have a single format? E.g.

format: get ip {{tag_key}} {{tag_value}}
User input: 'get ip ec2_tag_cluster qa-blue tag_key2=a tag_value2=b'

Another option would be to use a fixed keyword between the two tags:

Format: 'test {{key1}} {{value1}} and {{ key2 }} {{ value2 }}'
Text: 'test k1 v1 and k2 v2'
Result: {'key2': 'k2', 'key1': 'k1', 'value2': 'v2', 'value1': 'v1'}

from err-stackstorm.

nzlosh avatar nzlosh commented on June 20, 2024

After thinking on it a bit more the 2nd option will still generate two matches, so adding the and keyword isn't a solution. It looks like Key-Value Parameters is the reliable way to setup the action alias.

from err-stackstorm.

nzlosh avatar nzlosh commented on June 20, 2024

Closing this issue since action aliases are working as designed.

from err-stackstorm.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.