Closed emptywee closed 5 years ago
Mistral and orquesta have different implementation. Mistral calls st2 REST api to query key value, if API call returns OK, key value will be returned from response message, for this case, is null
. Orquesta query database directly and check return value after. If no record returns, exception is raised.
Tried out both mistral
and orquesta
for invalid key, empty key and key with null value. They have different behaviors.
Two issues:
201
, https://github.com/StackStorm/st2mistral/blob/master/st2mistral/functions/stackstorm.py#L82 exception is not raised.I don't know if it counts, but I'd prefer to get null if key doesn't exist, or at least have an option in st2kv call to not raise exceptions, since it's impossible to handle them within yaql or Jinja expressions.
If key exists and the value is null or empty string, we will fix to return null and empty string and not raise exception. If key does not exists, we will raise an exception. The fact that the mistral counterpart did not raise an exception is because it is a bug. I believe the st2kv should raise an exception if key does not exists so the user knows, especially when they expect it to be there. We can add a default
arg in the st2kv function if the user wants to silent the exception and just return some default value.
@m4dcoder that'll work for me and, I believe, for others as well!
Opened #https://github.com/StackStorm/st2mistral/issues/39 for mistral issue.
Woot-woot! @m4dcoder good job! Thanks bunch!
SUMMARY
Orquesta st2kv() behavior changed drastically, making it hard to migrate from Mistral engine.
ISSUE TYPE
STACKSTORM VERSION
Paste the output of
st2 --version
:OS / ENVIRONMENT / INSTALL METHOD
CentOS 6, custom install.
STEPS TO REPRODUCE
Meta:
Workflow:
EXPECTED RESULTS
null
published to theval
variableACTUAL RESULTS
And to illustrate item 2: